Added command MSB

This commit is contained in:
Mister Fix 2018-07-28 18:35:22 +03:00
parent 7cae397244
commit db5dd58db2
8 changed files with 34 additions and 30 deletions

View File

@ -1,2 +0,0 @@
# Rixa
Rixa Discord Bot

View File

@ -4,21 +4,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
import io.rixa.bot.commands.cmds.admin.ConfigCommand; import io.rixa.bot.commands.cmds.admin.ConfigCommand;
import io.rixa.bot.commands.cmds.admin.PMCommand; import io.rixa.bot.commands.cmds.admin.PMCommand;
import io.rixa.bot.commands.cmds.general.AdviceCommand; import io.rixa.bot.commands.cmds.general.*;
import io.rixa.bot.commands.cmds.general.FeaturesCommand;
import io.rixa.bot.commands.cmds.general.HelpCommand;
import io.rixa.bot.commands.cmds.general.InfoCommand;
import io.rixa.bot.commands.cmds.general.LeaderboardsCommand;
import io.rixa.bot.commands.cmds.general.MinecraftCommand;
import io.rixa.bot.commands.cmds.general.ModulesCommand;
import io.rixa.bot.commands.cmds.general.MusicCommand;
import io.rixa.bot.commands.cmds.general.PingCommand;
import io.rixa.bot.commands.cmds.general.QuoteCommand;
import io.rixa.bot.commands.cmds.general.RankCommand;
import io.rixa.bot.commands.cmds.general.RoleMemberList;
import io.rixa.bot.commands.cmds.general.ServerInfoCommand;
import io.rixa.bot.commands.cmds.general.UrbanDictionaryCommand;
import io.rixa.bot.commands.cmds.general.YoutubeCommand;
import io.rixa.bot.commands.cmds.moderator.BanCommand; import io.rixa.bot.commands.cmds.moderator.BanCommand;
import io.rixa.bot.commands.cmds.moderator.ClearCommand; import io.rixa.bot.commands.cmds.moderator.ClearCommand;
import io.rixa.bot.commands.cmds.moderator.MuteCommand; import io.rixa.bot.commands.cmds.moderator.MuteCommand;
@ -103,7 +89,7 @@ public class Rixa {
private void loadJDA() { private void loadJDA() {
JDABuilder jda = new JDABuilder(AccountType.BOT) JDABuilder jda = new JDABuilder(AccountType.BOT)
.setToken(configuration.getToken()) .setToken(configuration.getToken())
.setGame(Game.of(GameType.WATCHING, configuration.getBotGame())) .setGame(Game.of(GameType.DEFAULT, configuration.getBotGame()))
.setEventManager(new AnnotatedEventManager()) .setEventManager(new AnnotatedEventManager())
.addEventListener(new ReadyListener(), new BotJoinListener(), new MessageListener(), .addEventListener(new ReadyListener(), new BotJoinListener(), new MessageListener(),
new UserListener()) new UserListener())
@ -155,6 +141,7 @@ public class Rixa {
new MusicCommand("music", RixaPermission.NONE, "Listen to music right from discord!", new MusicCommand("music", RixaPermission.NONE, "Listen to music right from discord!",
CommandType.USER), CommandType.USER),
new PingCommand("ping", RixaPermission.NONE, "Check Rixa's ping!", CommandType.USER), new PingCommand("ping", RixaPermission.NONE, "Check Rixa's ping!", CommandType.USER),
new MsbCommand("msb", RixaPermission.NONE, "Create a mocking Spongebob meme", CommandType.USER),
new ServerInfoCommand("serverinfo", RixaPermission.NONE, new ServerInfoCommand("serverinfo", RixaPermission.NONE,
"Review information about the server!", CommandType.USER), "Review information about the server!", CommandType.USER),
new QuoteCommand("quote", RixaPermission.NONE, new QuoteCommand("quote", RixaPermission.NONE,

View File

@ -0,0 +1,22 @@
package io.rixa.bot.commands.cmds.general;
import io.rixa.bot.commands.Command;
import io.rixa.bot.commands.handler.CommandType;
import io.rixa.bot.commands.perms.RixaPermission;
import io.rixa.bot.utils.MessageFactory;
import net.dv8tion.jda.core.entities.Guild;
import net.dv8tion.jda.core.entities.Member;
import net.dv8tion.jda.core.entities.TextChannel;
public class MsbCommand extends Command {
public MsbCommand(String command, RixaPermission rixaPermission, String description, CommandType commandType) {
super(command, rixaPermission, description, commandType);
}
@Override
public void execute(String commandLabel, Guild guild, Member member, TextChannel channel, String[] args) {
String str = String.join("_", args);
MessageFactory.create("Mocking Spongebob").setImage("https://mockingspongebob.org/"+str+".jpg").queue(channel);
}
}

View File

@ -7,7 +7,6 @@ import io.rixa.bot.utils.MessageFactory;
import net.dv8tion.jda.core.entities.Guild; import net.dv8tion.jda.core.entities.Guild;
import net.dv8tion.jda.core.entities.Member; import net.dv8tion.jda.core.entities.Member;
import net.dv8tion.jda.core.entities.TextChannel; import net.dv8tion.jda.core.entities.TextChannel;
import net.dv8tion.jda.core.events.message.guild.GuildMessageReceivedEvent;
public class PingCommand extends Command { public class PingCommand extends Command {

View File

@ -102,8 +102,6 @@ public class MessageListener {
commandName = commandName.replaceFirst(prefix, ""); commandName = commandName.replaceFirst(prefix, "");
try { try {
Command command = Rixa.getInstance().getCommandHandler().getCommand(commandName); Command command = Rixa.getInstance().getCommandHandler().getCommand(commandName);
//command.execute(event);
event.getMessage().delete().queueAfter(3, TimeUnit.SECONDS);
RixaGuild rixaGuild = GuildManager.getInstance().getGuild(event.getGuild()); RixaGuild rixaGuild = GuildManager.getInstance().getGuild(event.getGuild());
if (!event.getGuild().getOwner().getUser().getId().equalsIgnoreCase(event.getAuthor().getId()) if (!event.getGuild().getOwner().getUser().getId().equalsIgnoreCase(event.getAuthor().getId())
&& command.getPermission() != null && command.getPermission() != RixaPermission.NONE && && command.getPermission() != null && command.getPermission() != RixaPermission.NONE &&

View File

@ -31,7 +31,7 @@ public class AudioPlayerSendHandler implements AudioSendHandler {
lastFrame = audioPlayer.provide(); lastFrame = audioPlayer.provide();
} }
byte[] data = lastFrame != null ? lastFrame.data : null; byte[] data = lastFrame != null ? lastFrame.getData() : null;
lastFrame = null; lastFrame = null;
return data; return data;

View File

@ -32,7 +32,7 @@ public class MessageFactory {
public MessageFactory() { public MessageFactory() {
this.builder = new EmbedBuilder(); this.builder = new EmbedBuilder();
selfDestruct = 20; selfDestruct = 0;
} }
public MessageFactory setTitle(String title, String url) { public MessageFactory setTitle(String title, String url) {

View File

@ -1,13 +1,13 @@
token: "YOUR_TOKEN_HERE" token: "kIWC67smb8Ysmxwj_Q1XaqWA4ciNQw2F"
botGame: "Rixa 2.0 | http://rixa.io/invite" botGame: "Rixa 3.0 beta | Hosted by Mister_Fix"
shards: 5 shards: 5
botAdmins: botAdmins:
- "YOUR_USER_ID_HERE" - "104695503358291968"
- "OTHER_ADMINS"
- "REMOVE_IF_YOU_DONT_WANT"
sqlCredentials: sqlCredentials:
hostName: "localhost" hostName: "localhost"
databaseName: "rixa" databaseName: "rixa"
userName: "rixa_users" userName: "root"
password: "password" password: ""
port: "3306" port: "3306"