use of com.github.vaerys.pogos.GuildConfig in project DiscordSailv2 by Vaerys-Dawn.
the class SetupHandler method setSetupStage.
public static void setSetupStage(CommandObject command, SetupStage stage) {
GuildConfig config = command.guild.config;
logger.debug("Setting Stage to " + stage.toString());
config.setupStage = stage;
config.setupUser = (stage == SetupStage.SETUP_UNSET) ? -1 : command.user.longID;
// send the title and step text to channel
if (stage != SetupStage.SETUP_UNSET && stage != SetupStage.SETUP_COMPLETE) {
// command.setChannel(command.user.getDmChannel());
// get stage:
SetupHandler currentStage = configStages.get(config.setupStage);
String titleText = "**__Step " + (stage.ordinal()) + ": " + currentStage.title() + "__**";
RequestHandler.sendMessage(titleText, command.user.getDmChannel());
// it is expected that you send the message yourself
currentStage.stepText(command);
}
}
use of com.github.vaerys.pogos.GuildConfig in project DiscordSailv2 by Vaerys-Dawn.
the class SpamHandler method checkForInvites.
public static boolean checkForInvites(CommandObject command) {
GuildConfig guildconfig = command.guild.config;
if (!guildconfig.denyInvites) {
return false;
}
IMessage message = command.message.get();
IGuild guild = command.guild.get();
IUser author = command.user.get();
List<String> inviteformats = new ArrayList<String>() {
{
add("discord.gg");
add("discordapp.com/Invite/");
}
};
if (GuildHandler.testForPerms(command, Permissions.MANAGE_MESSAGES))
return false;
boolean inviteFound = false;
boolean shouldDelete = false;
ProfileObject object = command.user.getProfile(command.guild);
boolean userSettingDenied = false;
if (object != null) {
userSettingDenied = object.getSettings().contains(UserSetting.DENY_INVITES);
}
for (String s : inviteformats) {
if (message.toString().toLowerCase().contains(s.toLowerCase())) {
inviteFound = true;
}
}
boolean isTrusted = guildconfig.testIsTrusted(author, guild);
if (userSettingDenied || !isTrusted) {
shouldDelete = true;
}
if (inviteFound && shouldDelete) {
String response;
if (userSettingDenied) {
response = "> " + command.user.mention() + ", you do not have permission to post Instant Invites.";
} else {
response = "> " + command.user.mention() + ", please do not post Instant Invites.";
}
RequestHandler.deleteMessage(message);
command.guild.sendDebugLog(command, "INVITE_REMOVAL", "REMOVED", message.getContent());
RequestHandler.sendMessage(response, command.channel.get());
return true;
}
return false;
}
Aggregations