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

Commit

Permalink
Rules Command feature
Browse files Browse the repository at this point in the history
  • Loading branch information
greg6775 committed Dec 2, 2019
1 parent 03b5c33 commit e7e55e4
Show file tree
Hide file tree
Showing 6 changed files with 153 additions and 137 deletions.
25 changes: 13 additions & 12 deletions example-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@
"Owners":
[],
"Database":{"IP":"",
"Port":6775,
"DBName":"",
"Username":"",
"Password":""},
"Tokens":{
"BotToken":"",
"Giphy":"",
"Port": 6775,
"DBName": "",
"Username": "",
"Password": ""},
"Tokens": {
"BotToken": "",
"Giphy": "",
"GitHub": "",
"MythicalBotList":"",
"BotsForDiscord":"",
"DiscordBotList":"",
"DiscordBestBots":"",
"MythicalBotList": "",
"BotsForDiscord": "",
"DiscordBotList": "",
"DiscordBestBots": "",
"DiscordBoats": "",
"YetAnotherBotList": "",
"DiscordExtremeList": "",
"DiscordBotReviews": "",
"DiscordBots": ""
"DiscordBots": "",
"BotListSpace": ""
}
}
12 changes: 11 additions & 1 deletion src/main/java/com/bbn/hadder/Rethink.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,11 @@ public void insertUser(String id) {
this.insert("user", r.hashMap("id", id).with("prefix", "h."));
}

public void updateRules(String guild_id, String message_id, String role_id) {
public void updateRules(String guild_id, String message_id, String role_id, String accept_emote, String decline_emote) {
this.update("server", guild_id, "message_id", message_id);
this.update("server", guild_id, "role_id", role_id);
this.update("server", guild_id, "accept_emote", accept_emote);
this.update("server", guild_id, "decline_emote", decline_emote);
}

public String getRulesMID(String guild_id) {
Expand All @@ -163,6 +165,14 @@ public String getRulesRID(String guild_id) {
return (String) this.get("server", "id", guild_id, "role_id");
}

public String getRulesAEmote(String guild_id) {
return (String) this.get("server", "id", guild_id, "accept_emote");
}

public String getRulesDEmote(String guild_id) {
return (String) this.get("server", "id", guild_id, "decline_emote");
}

public void setInviteDetection(String guild_id, boolean b) {
try {
r.table("server").get(guild_id).update(r.hashMap("invite_detect", b)).run(conn);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class InviteDetectCommand implements Command {
@Override
public void executed(String[] args, CommandEvent event) {
if (args.length == 1) {
if (event.getMember().hasPermission(Permission.MANAGE_SERVER)) {
if (event.getMember().hasPermission(Permission.MANAGE_SERVER) || event.getConfig().getOwners().toString().contains(event.getAuthor().getId())) {
String opinion = args[0].toLowerCase();
switch (opinion) {
case "on":
Expand Down
Loading

1 comment on commit e7e55e4

@greg6775
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.