use of net.dv8tion.jda.api.events.message.guild.GuildMessageUpdateEvent in project Gary by help-chat.
the class LoggingHandler method execute.
@Override
protected void execute(GenericEvent event) {
switch(EventsEnum.fromEvent(event)) {
case MEMBER_JOIN:
GuildMemberJoinEvent e = (GuildMemberJoinEvent) event;
log(EventsEnum.MEMBER_JOIN, e.getJDA(), e.getGuild(), e.getUser());
break;
case MEMBER_LEAVE:
if (!wasBan) {
GuildMemberLeaveEvent e2 = (GuildMemberLeaveEvent) event;
log(EventsEnum.MEMBER_LEAVE, e2.getJDA(), e2.getGuild(), e2.getUser());
} else {
wasBan = false;
}
break;
case MEMBER_BANNED:
wasBan = true;
GuildBanEvent e3 = (GuildBanEvent) event;
log(EventsEnum.MEMBER_BANNED, e3.getJDA(), e3.getGuild(), e3.getUser());
break;
case MESSAGE_EDIT:
GuildMessageUpdateEvent e5 = (GuildMessageUpdateEvent) event;
if (!e5.getAuthor().isBot() && StringUtils.equalsIgnoreCase(e5.getChannel().getName(), Constants.CHANNELS)) {
log(EventsEnum.MESSAGE_EDIT, e5.getJDA(), e5.getGuild(), e5.getAuthor(), e5.getChannel(), e5.getMessage());
}
break;
case MESSAGE_DELETE:
GuildMessageDeleteEvent e6 = (GuildMessageDeleteEvent) event;
if ((StringUtils.equalsIgnoreCase(e6.getChannel().getName(), Constants.CHANNELS))) {
log(EventsEnum.MESSAGE_DELETE, e6.getJDA(), e6.getGuild(), MessageUtils.getAuthor(e6.getMessageIdLong()), e6.getChannel(), e6.getMessageIdLong(), MessageUtils.getMessage(e6.getMessageIdLong()));
}
break;
case MESSAGE_BULK_DELETE:
MessageBulkDeleteEvent e7 = (MessageBulkDeleteEvent) event;
if ((StringUtils.equalsIgnoreCase(e7.getChannel().getName(), Constants.CHANNELS))) {
log(EventsEnum.MESSAGE_BULK_DELETE, e7.getJDA(), e7.getGuild(), e7.getChannel(), e7.getMessageIds());
}
break;
case VOICE_JOIN:
GuildVoiceJoinEvent e8 = (GuildVoiceJoinEvent) event;
log(EventsEnum.VOICE_JOIN, e8.getJDA(), e8.getGuild(), e8.getMember().getUser(), e8.getChannelJoined());
break;
}
}
use of net.dv8tion.jda.api.events.message.guild.GuildMessageUpdateEvent in project TechDiscordBot by TechsCode-Team.
the class WordBlacklistModule method onMessageUpdate.
@SubscribeEvent
public void onMessageUpdate(GuildMessageUpdateEvent e) {
if (e.getMember() == null || e.getAuthor().isBot() || IGNORED_CATEGORIES.query().stream().anyMatch(c -> c.getId().equals(e.getChannel().getParent().getId())))
return;
if (runMatcher(e.getMessage().getContentRaw().toLowerCase())) {
e.getMessage().delete().queue();
new TechEmbedBuilder("Blocked Word(s)").color(Color.RED).text("Your message contained a world which is in our blacklist.\n\nIf you think this is a mistake, take a look at our [**word blacklist**](" + URL + ").").sendTemporary(e.getChannel(), 10, TimeUnit.SECONDS);
}
}
use of net.dv8tion.jda.api.events.message.guild.GuildMessageUpdateEvent in project TechDiscordBot by TechsCode-Team.
the class UrlWhitelistModule method onMessageUpdate.
@SubscribeEvent
public void onMessageUpdate(GuildMessageUpdateEvent e) {
if (e.getMember() == null || e.getAuthor().isBot() || e.getMember().getRoles().contains(STAFF_ROLE.query().first()) || IGNORED_CATEGORIES.query().stream().anyMatch(c -> c.getId().equals(e.getChannel().getParent().getId())))
return;
boolean block = checkMessage(e.getMessage().getContentRaw());
if (block) {
e.getMessage().delete().queue();
new TechEmbedBuilder("Blocked URL(s)").color(Color.RED).text("Your message contained a URL which is not in our whitelist.\n\nIf you think this is a mistake, take a look at our [**link whitelist**](" + URL + ").").sendTemporary(e.getChannel(), 10, TimeUnit.SECONDS);
}
}
Aggregations