Fix admin stuff, add better user exclusion, remove useless events

This commit is contained in:
Julius de Jeu 2019-01-23 17:18:30 +01:00
parent 948b32f387
commit afa1cd2144
3 changed files with 6 additions and 39 deletions

View file

@ -4,21 +4,19 @@ import net.dv8tion.jda.core.OnlineStatus
import net.dv8tion.jda.core.Permission import net.dv8tion.jda.core.Permission
import net.dv8tion.jda.core.events.guild.voice.GuildVoiceLeaveEvent import net.dv8tion.jda.core.events.guild.voice.GuildVoiceLeaveEvent
import net.dv8tion.jda.core.events.message.MessageReceivedEvent import net.dv8tion.jda.core.events.message.MessageReceivedEvent
import net.dv8tion.jda.core.events.message.react.MessageReactionAddEvent
import net.dv8tion.jda.core.events.message.react.MessageReactionRemoveEvent
import net.dv8tion.jda.core.hooks.ListenerAdapter import net.dv8tion.jda.core.hooks.ListenerAdapter
import nl.voidcorp.dbot.commands.GSM import nl.voidcorp.dbot.commands.GSM
import nl.voidcorp.dbot.music.guildMusicMap import nl.voidcorp.dbot.music.guildMusicMap
object Events : ListenerAdapter() { object Events : ListenerAdapter() {
override fun onMessageReceived(event: MessageReceivedEvent) { override fun onMessageReceived(event: MessageReceivedEvent) {
if ((event.message.contentStripped.toLowerCase().contains("fraud")) /*if ((event.message.contentStripped.toLowerCase().contains("fraud"))
and (event.author != event.jda.selfUser) and (event.author != event.jda.selfUser)
) { ) {
val e = event.message.guild.getEmotesByName("fr00d", true).firstOrNull() val e = event.message.guild.getEmotesByName("fr00d", true).firstOrNull()
if (e != null) if (e != null)
event.message.addReaction(e).queue() event.message.addReaction(e).queue()
} }*/
/*if (event.message.voiceChannel.idLong == 499628388659625995) { /*if (event.message.voiceChannel.idLong == 499628388659625995) {
if (event.message.mentionedMembers.contains(event.guild.getMember(event.jda.selfUser)) and (event.message.author != event.jda.selfUser)) { if (event.message.mentionedMembers.contains(event.guild.getMember(event.jda.selfUser)) and (event.message.author != event.jda.selfUser)) {
if (event.message.contentStripped.toLowerCase().contains("hello")) { if (event.message.contentStripped.toLowerCase().contains("hello")) {
@ -87,39 +85,6 @@ object Events : ListenerAdapter() {
} }
override fun onMessageReactionAdd(event: MessageReactionAddEvent) {
if (event.channel.idLong == 499523462449201162 && event.messageIdLong == 499929881883181064) {
event.guild.controller.addSingleRoleToMember(
event.member, event.guild.getRoleById(
when (event.reactionEmote.name) {
"\uD83C\uDFB5" -> 499925623188488192
"\uD83D\uDCBE" -> 499525260912361472
"\uD83D\uDCF8" -> 499525337034653707
"\uD83C\uDFA8" -> 499525305405276181
"\uD83D\uDD0D" -> 499525364708540416
else -> 499938201444810782
}
)
).queue()
}
}
override fun onMessageReactionRemove(event: MessageReactionRemoveEvent) {
if (event.channel.idLong == 499523462449201162 && event.messageIdLong == 499929881883181064) {
event.guild.controller.removeSingleRoleFromMember(
event.member, event.guild.getRoleById(
when (event.reactionEmote.name) {
"\uD83C\uDFB5" -> 499925623188488192
"\uD83D\uDCBE" -> 499525260912361472
"\uD83D\uDCF8" -> 499525337034653707
"\uD83C\uDFA8" -> 499525305405276181
"\uD83D\uDD0D" -> 499525364708540416
else -> 499938201444810782
}
)
).queue()
}
}
override fun onGuildVoiceLeave(event: GuildVoiceLeaveEvent) { override fun onGuildVoiceLeave(event: GuildVoiceLeaveEvent) {
if (event.channelLeft.members.size == 1) { if (event.channelLeft.members.size == 1) {

View file

@ -60,9 +60,11 @@ object Logging : ListenerAdapter() {
return em.build() return em.build()
} }
private val nocheck = hashSetOf(260390293881356294, 144116077129891840, 131399667442384896)
override fun onGuildMemberNickChange(event: GuildMemberNickChangeEvent) { override fun onGuildMemberNickChange(event: GuildMemberNickChangeEvent) {
val lc = logChannel(event.guild) val lc = logChannel(event.guild)
if ((event.user.idLong == 144116077129891840) or (event.user.idLong == 131399667442384896)) return if (event.user.idLong in nocheck) return
if (lc != null) { if (lc != null) {
val em = buildEmbed( val em = buildEmbed(
event.member, event.member,

View file

@ -12,7 +12,7 @@ open class UnityCategory(
) { ) {
open fun test(ce: UnityCommandEvent): Boolean { open fun test(ce: UnityCommandEvent): Boolean {
/*if (ce.member.hasPermission(Permission.ADMINISTRATOR)) return true*/ /*if (ce.member.hasPermission(Permission.ADMINISTRATOR)) return true*/
if (ce.member.roles.firstOrNull { it.name.equals("admin", true) } != null) return true if (AdminCategory.test(ce)) return true
if (channels.all { ce.guild.getTextChannelsByName(it, true).firstOrNull() == null }) return true if (channels.all { ce.guild.getTextChannelsByName(it, true).firstOrNull() == null }) return true
if (channels.isEmpty()) return true if (channels.isEmpty()) return true