use of me.shadorc.shadbot.exception.MissingArgumentException in project Shadbot by Shadorc.
the class AutoMessageSetting method updateJoinMessage.
private void updateJoinMessage(Context context, Action action, List<String> args) throws MissingArgumentException {
DBGuild dbGuild = Database.getDBGuild(context.getGuild());
if (Action.ENABLE.equals(action)) {
if (args.size() < 3) {
throw new MissingArgumentException();
}
String message = args.get(2);
dbGuild.setSetting(SettingEnum.JOIN_MESSAGE, message);
BotUtils.sendMessage(String.format(Emoji.CHECK_MARK + " Join message set to `%s`", message), context.getChannel());
} else if (Action.DISABLE.equals(action)) {
dbGuild.removeSetting(SettingEnum.JOIN_MESSAGE);
BotUtils.sendMessage(Emoji.CHECK_MARK + " Join message disabled.", context.getChannel());
}
}
Aggregations