Skip to content

Commit

Permalink
Made Yui ignore bots for currently commands and made .t only respond …
Browse files Browse the repository at this point in the history
…in PMs

Updated to JDA 2.2.0_341
  • Loading branch information
DV8FromTheWorld committed Jul 30, 2016
1 parent 0987f39 commit ff53357
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ repositories {
}

dependencies {
compile "net.dv8tion:JDA:2.1.1_311"
compile "net.dv8tion:JDA:2.2.0_341"
compile "net.lingala.zip4j:zip4j:1.3.2"
compile "com.google.code.gson:gson:2.4"
compile "org.xerial:sqlite-jdbc:3.8.11.2"
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/net/dv8tion/discord/commands/Command.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public abstract class Command extends ListenerAdapter
@Override
public void onMessageReceived(MessageReceivedEvent e)
{
if (e.getAuthor().isBot() && !respondToBots())
return;
if (containsCommand(e.getMessage()))
onCommand(e, commandArgs(e.getMessage()));
}
Expand Down Expand Up @@ -64,4 +66,9 @@ protected Message sendMessage(MessageReceivedEvent e, String message)
{
return sendMessage(e, new MessageBuilder().appendString(message).build());
}

protected boolean respondToBots()
{
return false;
}
}
5 changes: 4 additions & 1 deletion src/main/java/net/dv8tion/discord/commands/TestCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public class TestCommand extends Command
@Override
public void onCommand(MessageReceivedEvent e, String[] args)
{
if (!e.isPrivate())
return;
sendMessage(e, new MessageBuilder()
.appendString("Yes, ")
.appendMention(e.getAuthor())
Expand Down Expand Up @@ -78,6 +80,7 @@ public List<String> getUsageInstructions()
{
return Collections.singletonList(
".test\n"
+ "Really, this command is just a test, however, it will @Mention you.");
+ "Really, this command is just a test, however, it will @Mention you.\n"
+ "Also, it is restricted to PMs currently.");
}
}

0 comments on commit ff53357

Please sign in to comment.