-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added SetRatelimit Command * added Toggle.Ratelimiting * ratelimiting has been added this means that if enabled over a 10 second period if a user sends more than the Guild's Ratelimit their messages will automatically be deleted and a DM will be sent telling them that they are being rate limited. if a muted role is set up and muteRepeatOffenders is enabled it S.A.I.L will now automatically mute the user if they oversend by 3 messages and if an admin channel is set up will send a message there else it will post the message in the channel they abused the rate limit in. (This is not a slowmode and is global across the whole guild.)
- Loading branch information
1 parent
f6e4461
commit 502fa62
Showing
19 changed files
with
785 additions
and
285 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
package Commands.Admin; | ||
|
||
import Commands.Command; | ||
import Commands.CommandObject; | ||
import sx.blah.discord.handle.obj.Permissions; | ||
|
||
/** | ||
* Created by Vaerys on 21/02/2017. | ||
*/ | ||
public class MaxMessages implements Command { | ||
|
||
@Override | ||
public String execute(String args, CommandObject command) { | ||
try { | ||
int max = Integer.parseInt(args); | ||
if (max <= 0){ | ||
return "> Rate Limit must be larger than 0"; | ||
}else if (max > 10){ | ||
return "> That would be stopped by Discord's Rate Limit."; | ||
}else{ | ||
command.guildConfig.setRateLimit(max); | ||
return "> Guild Rate limit set to **" + max + "** messages per user every 10 seconds."; | ||
} | ||
}catch (NumberFormatException e){ | ||
return "> You need to specify a number."; | ||
} | ||
} | ||
|
||
@Override | ||
public String[] names() { | ||
return new String[]{"SetRateLimit"}; | ||
} | ||
|
||
@Override | ||
public String description() { | ||
return "Sets the rate limit for your Guild. (Maximum Messages per 10 seconds per person.)"; | ||
} | ||
|
||
@Override | ||
public String usage() { | ||
return "[Max messages per 10 sec]"; | ||
} | ||
|
||
@Override | ||
public String type() { | ||
return TYPE_ADMIN; | ||
} | ||
|
||
@Override | ||
public String channel() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Permissions[] perms() { | ||
return new Permissions[]{Permissions.MANAGE_SERVER}; | ||
} | ||
|
||
@Override | ||
public boolean requiresArgs() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean doAdminLogging() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public String dualDescription() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public String dualUsage() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public String dualType() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Permissions[] dualPerms() { | ||
return new Permissions[0]; | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package GuildToggles.Toggles; | ||
|
||
import Commands.CommandObject; | ||
import GuildToggles.GuildToggle; | ||
import POGOs.GuildConfig; | ||
|
||
/** | ||
* Created by Vaerys on 21/02/2017. | ||
*/ | ||
public class RateLimiting implements GuildToggle{ | ||
|
||
@Override | ||
public String name() { | ||
return "RateLimiting"; | ||
} | ||
|
||
@Override | ||
public boolean toggle(GuildConfig config) { | ||
return config.rateLimiting = !config.rateLimiting; | ||
} | ||
|
||
@Override | ||
public boolean get(GuildConfig config) { | ||
return config.rateLimiting; | ||
} | ||
|
||
@Override | ||
public void execute(CommandObject command) { | ||
|
||
} | ||
|
||
@Override | ||
public boolean isModule() { | ||
return false; | ||
} | ||
} |
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
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
Oops, something went wrong.