Skip to content
This repository has been archived by the owner on Mar 5, 2023. It is now read-only.

Commit

Permalink
Merge pull request #60 from BigBotNetwork/greg-dev
Browse files Browse the repository at this point in the history
RENAME!
  • Loading branch information
Skidder authored Nov 16, 2019
2 parents 60b24e6 + 983ea31 commit 3892921
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/main/java/com/bbn/hadder/Rethink.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ public String getUserPrefix(String id) {
return this.get("user", "id", id, "prefix");
}

public String setServerPrefix(String prefix, String guildid) {
public String setGuildPrefix(String prefix, String guildid) {
return this.update("server", guildid, "prefix", prefix);
}

public String getServerPrefix(String id) {
public String getGuildPrefix(String id) {
return this.get("server", "id", id, "prefix");
}

public String insertServer(String id) {
public String insertGuild(String id) {
return this.insert("server", r.hashMap("id", id).with("prefix", "h."));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public void executed(String[] args, CommandEvent event) {
if (args.length == 1) {
if (!args[0].contains("\"")) {

event.getRethink().setServerPrefix(args[0], event.getGuild().getId());
event.getRethink().setGuildPrefix(args[0], event.getGuild().getId());

EmbedBuilder builder = new EmbedBuilder();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ public void executed(String[] args, CommandEvent event) {
event.getGuild().modifyNickname(event.getMessage().getMentionedMembers().get(0), event.getMessage().getContentRaw().replaceFirst(event.getRethink().getUserPrefix(event.getMember().getId()) + "nick " + args[0], "")).reason("Nicked by " + event.getAuthor().getAsTag()).queue();
EmbedBuilder builder = new EmbedBuilder();
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.INFO, builder).setTitle("✅ Successfully nicked ✅").setDescription("I successfully nicked " + event.getMessage().getMentionedMembers().get(0).getUser().getAsTag() + ".").build()).queue();
} else if (event.getMessage().getContentRaw().startsWith(event.getRethink().getServerPrefix(event.getGuild().getId()))) {
event.getGuild().modifyNickname(event.getMessage().getMentionedMembers().get(0), event.getMessage().getContentRaw().replaceFirst(event.getRethink().getServerPrefix(event.getGuild().getId()) + "nick " + args[0], "")).reason("Nicked by " + event.getAuthor().getAsTag()).queue();
} else if (event.getMessage().getContentRaw().startsWith(event.getRethink().getGuildPrefix(event.getGuild().getId()))) {
event.getGuild().modifyNickname(event.getMessage().getMentionedMembers().get(0), event.getMessage().getContentRaw().replaceFirst(event.getRethink().getGuildPrefix(event.getGuild().getId()) + "nick " + args[0], "")).reason("Nicked by " + event.getAuthor().getAsTag()).queue();
EmbedBuilder builder = new EmbedBuilder();
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.INFO, builder).setTitle("✅ Successfully nicked ✅").setDescription("I successfully nicked " + event.getMessage().getMentionedMembers().get(0).getUser().getAsTag() + ".").build()).queue();
}
Expand All @@ -43,8 +43,8 @@ public void executed(String[] args, CommandEvent event) {
event.getGuild().getSelfMember().modifyNickname(event.getMessage().getContentRaw().replaceFirst(event.getRethink().getUserPrefix(event.getMember().getId()) + "nick " + args[0], "")).reason("Nicked by " + event.getAuthor().getAsTag()).queue();
EmbedBuilder builder = new EmbedBuilder();
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.INFO, builder).setTitle("✅ Successfully nicked ✅").setDescription("I successfully changed my nickname.").build()).queue();
} else if (event.getMessage().getContentRaw().startsWith(event.getRethink().getServerPrefix(event.getGuild().getId()))) {
event.getGuild().getSelfMember().modifyNickname(event.getMessage().getContentRaw().replaceFirst(event.getRethink().getServerPrefix(event.getGuild().getId()) + "nick " + args[0], "")).reason("Nicked by " + event.getAuthor().getAsTag()).queue();
} else if (event.getMessage().getContentRaw().startsWith(event.getRethink().getGuildPrefix(event.getGuild().getId()))) {
event.getGuild().getSelfMember().modifyNickname(event.getMessage().getContentRaw().replaceFirst(event.getRethink().getGuildPrefix(event.getGuild().getId()) + "nick " + args[0], "")).reason("Nicked by " + event.getAuthor().getAsTag()).queue();
EmbedBuilder builder = new EmbedBuilder();
event.getTextChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.INFO, builder).setTitle("✅ Successfully nicked ✅").setDescription("I successfully changed my nickname.").build()).queue();
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/bbn/hadder/listener/CommandListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public CommandListener(Rethink rethink, CommandHandler handler) {
public void onMessageReceived(MessageReceivedEvent event) {
if (event.isFromType(ChannelType.TEXT)) {
if (!event.getAuthor().isBot()) {
String[] prefixes = {rethink.getUserPrefix(event.getAuthor().getId()), rethink.getServerPrefix(event.getGuild().getId()), event.getGuild().getSelfMember().getAsMention()+" ", event.getGuild().getSelfMember().getAsMention()};
String[] prefixes = {rethink.getUserPrefix(event.getAuthor().getId()), rethink.getGuildPrefix(event.getGuild().getId()), event.getGuild().getSelfMember().getAsMention()+" ", event.getGuild().getSelfMember().getAsMention()};
for (String prefix : prefixes) {
if (event.getMessage().getContentRaw().startsWith(prefix)) {
handler.handle(event, rethink, prefix);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/bbn/hadder/listener/GuildListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public void onGuildJoin(GuildJoinEvent event) {
}
}

rethink.insertServer(event.getGuild().getId());
rethink.insertGuild(event.getGuild().getId());
EmbedBuilder builder = new EmbedBuilder();
event.getJDA().getTextChannelById("475722540140986369").sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.INFO, builder)
.setTitle("Joined Server")
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/bbn/hadder/listener/MentionListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public void onMessageReceived(@Nonnull MessageReceivedEvent event) {
.addField("Users", String.valueOf(event.getJDA().getUsers().size()), false)
.addField("Guilds", String.valueOf(event.getJDA().getGuilds().size()), false)
.addField("Prefix (User)", rethink.getUserPrefix(event.getAuthor().getId()), false)
.addField("Prefix (Guild)", rethink.getServerPrefix(event.getGuild().getId()), false);
.addField("Prefix (Guild)", rethink.getGuildPrefix(event.getGuild().getId()), false);
event.getChannel().sendMessage(new MessageEditor().setDefaultSettings(MessageEditor.Messagetype.INFO, builder).build()).queue();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/bbn/hadder/listener/ReadyListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void onReady(@Nonnull ReadyEvent event) {
}
}
for (Guild g : event.getJDA().getGuilds()) {
rethink.insertServer(g.getId());
rethink.insertGuild(g.getId());
}

new BotList(config).post();
Expand Down

0 comments on commit 3892921

Please sign in to comment.