use of net.dv8tion.jda.core.entities.TextChannel in project Rubicon by Rubicon-Bot.
the class CommandWhitelist method execute.
@Override
protected Message execute(CommandManager.ParsedCommandInvocation parsedCommandInvocation, UserPermissions userPermissions) {
String[] args = parsedCommandInvocation.getArgs();
Member member = parsedCommandInvocation.getMember();
Guild guild = parsedCommandInvocation.getGuild();
TextChannel channel = parsedCommandInvocation.getTextChannel();
Message message = parsedCommandInvocation.getMessage();
if (args.length == 0)
return createHelpMessage();
GuildSQL guildSQL = GuildSQL.fromGuild(guild);
if (guildSQL.enabledBlacklist()) {
return new MessageBuilder().setEmbed(EmbedUtil.error("Already using blacklist", "You can't use black- and whitelist on the same server").build()).build();
}
switch(args[0]) {
case "list":
executeList(args, member, guild, channel);
break;
case "add":
case "whitelist":
executeAdd(args, member, guild, channel, message);
break;
case "remove":
case "blacklist":
executeRemove(args, member, guild, channel, message);
break;
default:
SafeMessage.sendMessage(channel, createHelpMessage(), 5);
break;
}
return null;
}
use of net.dv8tion.jda.core.entities.TextChannel in project Rubicon by Rubicon-Bot.
the class ChannelDeleteListener method onTextChannelDelete.
@Override
public void onTextChannelDelete(TextChannelDeleteEvent e) {
String portalStatus = RubiconBot.getMySQL().getGuildValue(e.getGuild(), "portal");
if (portalStatus.equalsIgnoreCase("closed") || portalStatus.equalsIgnoreCase("waiting"))
return;
if (portalStatus.equalsIgnoreCase("open")) {
TextChannel channel = e.getJDA().getTextChannelById(RubiconBot.getMySQL().getPortalValue(e.getGuild(), "channelid"));
if (e.getChannel().getId() != channel.getId())
return;
Guild partnerGuild = e.getJDA().getGuildById(RubiconBot.getMySQL().getPortalValue(e.getGuild(), "partnerid"));
RubiconBot.getMySQL().deletePortal(e.getGuild());
RubiconBot.getMySQL().deletePortal(partnerGuild);
RubiconBot.getMySQL().updateGuildValue(e.getGuild(), "portal", "closed");
RubiconBot.getMySQL().updateGuildValue(partnerGuild, "portal", "closed");
sendPortalNotification(e.getGuild(), "Portal was closed.");
sendPortalNotification(partnerGuild, "Portal was closed on the other side.");
}
}
use of net.dv8tion.jda.core.entities.TextChannel in project Rubicon by Rubicon-Bot.
the class VerificationListener method onGuildMemberJoin.
@Override
public void onGuildMemberJoin(GuildMemberJoinEvent event) {
if (event.getUser().isBot())
return;
if (!RubiconBot.getMySQL().verificationEnabled(event.getGuild()))
return;
if (event.getUser().isBot())
return;
TextChannel channel = event.getGuild().getTextChannelById(RubiconBot.getMySQL().getVerificationValue(event.getGuild(), "channelid"));
Message message = SafeMessage.sendMessageBlocking(channel, RubiconBot.getMySQL().getVerificationValue(event.getGuild(), "text").replace("%user%", event.getUser().getAsMention()).replace("%guild%", event.getGuild().getName()));
CommandVerification.users.put(message, event.getUser());
String emoteRaw = RubiconBot.getMySQL().getVerificationValue(event.getGuild(), "emote");
if (!StringUtil.isNumeric(emoteRaw))
message.addReaction(emoteRaw).queue();
else
message.addReaction(event.getJDA().getEmoteById(emoteRaw)).queue();
int delay = Integer.parseInt(RubiconBot.getMySQL().getVerificationValue(event.getGuild(), "kicktime"));
if (delay == 0)
return;
new VerificationUserHandler.VerifyUser(event.getMember(), message);
new VerificationKickHandler.VerifyKick(event.getGuild(), event.getMember(), getKickTime(delay), RubiconBot.getMySQL().getVerificationValue(event.getGuild(), "kicktext").replace("%guild%", event.getGuild().getName()), message.getIdLong(), false, true);
}
use of net.dv8tion.jda.core.entities.TextChannel in project Rubicon by Rubicon-Bot.
the class MemberLeaveListener method onGuildMemberLeave.
@Override
public void onGuildMemberLeave(GuildMemberLeaveEvent event) {
/* Leave message */
String message = RubiconBot.getMySQL().getGuildValue(event.getGuild(), "leavemsg").replace("%user%", event.getMember().getAsMention()).replace("%guild%", event.getGuild().getName());
if (message == null)
return;
if (message.equalsIgnoreCase("0") || message.equalsIgnoreCase(" 0"))
return;
TextChannel channel = event.getGuild().getTextChannelById(RubiconBot.getMySQL().getGuildValue(event.getGuild(), "channel"));
if (channel == null)
return;
SafeMessage.sendMessage(channel, message);
}
use of net.dv8tion.jda.core.entities.TextChannel in project Rubicon by Rubicon-Bot.
the class ServerLogHandler method onGuildMemberJoin.
@Override
public void onGuildMemberJoin(GuildMemberJoinEvent event) {
if (!isEventEnabled(event.getGuild(), LogEventKeys.JOIN))
return;
TextChannel textChannel = getLogChannel(event.getGuild());
if (textChannel == null)
return;
EmbedBuilder embedBuilder = new EmbedBuilder();
embedBuilder.setAuthor("New member joined the server", null, event.getMember().getUser().getAvatarUrl());
embedBuilder.setDescription("**" + event.getMember().getEffectiveName() + " (" + event.getMember().getUser().getId() + ")** joined the server");
embedBuilder.setColor(evJoinColor);
sendLog(textChannel, embedBuilder);
}
Aggregations