-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Additionally, modified some other files to fix small bugs.
- Loading branch information
1 parent
733fc35
commit edbdd65
Showing
8 changed files
with
122 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
src/main/java/com/beanbeanjuice/cafebot/commands/fun/rate/RateCaffeinatedSubCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.beanbeanjuice.cafebot.commands.fun.rate; | ||
|
||
import com.beanbeanjuice.cafebot.CafeBot; | ||
import com.beanbeanjuice.cafebot.utility.commands.Command; | ||
import com.beanbeanjuice.cafebot.utility.commands.ISubCommand; | ||
import com.beanbeanjuice.cafebot.utility.helper.Helper; | ||
import net.dv8tion.jda.api.entities.User; | ||
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent; | ||
import net.dv8tion.jda.api.interactions.commands.OptionMapping; | ||
import net.dv8tion.jda.api.interactions.commands.OptionType; | ||
import net.dv8tion.jda.api.interactions.commands.build.OptionData; | ||
|
||
import java.util.Optional; | ||
|
||
public class RateCaffeinatedSubCommand extends Command implements ISubCommand { | ||
|
||
public RateCaffeinatedSubCommand(CafeBot cafeBot) { | ||
super(cafeBot); | ||
} | ||
|
||
@Override | ||
public void handle(SlashCommandInteractionEvent event) { | ||
Optional<OptionMapping> userMapping = Optional.ofNullable(event.getOption("user")); | ||
|
||
User user = userMapping.map(OptionMapping::getAsUser).orElse(event.getUser()); | ||
int percentage = Helper.getRandomInteger(0, 101); | ||
|
||
event.getHook().sendMessageEmbeds(Helper.successEmbed( | ||
"☕ Caffeine Rating ☕", | ||
String.format("%s is %d%% caffeinated! %s", user.getAsMention(), percentage, "<a:yayaya:954426079177744445>") | ||
)).mention(user).queue(); | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "caffeinated"; | ||
} | ||
|
||
@Override | ||
public String getDescription() { | ||
return "Rate how caffeinated you or someone is!"; | ||
} | ||
|
||
@Override | ||
public OptionData[] getOptions() { | ||
return new OptionData[] { | ||
new OptionData(OptionType.USER, "user", "The person who's caffeine levels you want to see.") | ||
}; | ||
} | ||
|
||
} |
51 changes: 51 additions & 0 deletions
51
src/main/java/com/beanbeanjuice/cafebot/commands/fun/rate/RateCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.beanbeanjuice.cafebot.commands.fun.rate; | ||
|
||
import com.beanbeanjuice.cafebot.CafeBot; | ||
import com.beanbeanjuice.cafebot.utility.commands.Command; | ||
import com.beanbeanjuice.cafebot.utility.commands.ICommand; | ||
import com.beanbeanjuice.cafebot.utility.commands.ISubCommand; | ||
import net.dv8tion.jda.api.Permission; | ||
|
||
public class RateCommand extends Command implements ICommand { | ||
|
||
public RateCommand(final CafeBot cafeBot) { | ||
super(cafeBot); | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "rate"; | ||
} | ||
|
||
@Override | ||
public String getDescription() { | ||
return "Rate something!"; | ||
} | ||
|
||
@Override | ||
public Permission[] getPermissions() { | ||
return new Permission[0]; | ||
} | ||
|
||
@Override | ||
public boolean isEphemeral() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean isNSFW() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean allowDM() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public ISubCommand[] getSubCommands() { | ||
return new ISubCommand[] { | ||
new RateCaffeinatedSubCommand(cafeBot) | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters