I have the following error no instance(s) of type variable(s) R exist so that void conforms to Mono<? extends R>. How would I resolve this? Im writing a discord bot in java with Discord4J. When a user reacts to the bot emoji for the corresponding gender id like to write to the database (or in this example simply print) the user and their gender.
I have a database method:
public static void setUserGender(String u, ReactionEmoji e){ String gender = (e.equals(EmojiUtils.EMOJI_MALE)) ? "male" : "female"; Database.write(u, gender); } and the reactive command is this:
public Mono<Void> issueCommand(final String[] args, final MessageCreateEvent event, final GuildSettings settings) { Message msg = MessageUtils.sendMessage(event, "Welcome " + event.getMember().get().getNicknameMention() + "! It looks like you're new around here.\n No worries! " + "Lets get you started. What do you identify as?"); Mono<Void> maleReaction = msg.addReaction(EmojiUtils.EMOJI_MALE); Mono<Void> femaleReaction = msg.addReaction(EmojiUtils.EMOJI_FEMALE); Mono<Void> reactorEvent = event.getClient().on(ReactionAddEvent.class) .filter(e -> e.getMessageId().equals(event.getMessage().getId())) // on same message .filter(e -> e.getUserId().equals(event.getMember().get().getId())) // by same person .next() .flatMap(e -> Database.setUserGender(e.getUser().toString(), e.getEmoji())) .then(); return Mono.when(reactorEvent, maleReaction, femaleReaction); } https://stackoverflow.com/questions/65767618/discord4j-no-instances-of-type-variables-r-exist-so-that-void-conforms-to-m January 18, 2021 at 09:04AM
没有评论:
发表评论