Add role picker
This commit is contained in:
parent
eb23d5871a
commit
a3291e02b5
|
@ -2,8 +2,6 @@ plugins {
|
||||||
id 'java'
|
id 'java'
|
||||||
id 'org.jetbrains.kotlin.jvm' version '1.2.71'
|
id 'org.jetbrains.kotlin.jvm' version '1.2.71'
|
||||||
id 'com.github.johnrengelman.shadow' version '4.0.1'
|
id 'com.github.johnrengelman.shadow' version '4.0.1'
|
||||||
id 'com.sedmelluq.jdaction' version '1.0.2'
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
group 'nl.voidcorp.dbot'
|
group 'nl.voidcorp.dbot'
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package nl.voidcorp.dbot
|
package nl.voidcorp.dbot
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
object Events : ListenerAdapter() {
|
object Events : ListenerAdapter() {
|
||||||
|
@ -26,5 +28,70 @@ object Events : ListenerAdapter() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (event.author.idLong == 168743656738521088 && event.message.mentionedMembers.contains(event.guild.getMember(event.jda.selfUser))) {
|
||||||
|
/*if (event.message.contentStripped.contains("hide")) {
|
||||||
|
if (event.message.mentionedChannels.isNotEmpty()) {
|
||||||
|
val override = event.message.mentionedChannels[0].getPermissionOverride(event.guild.getRoleById(499512961103167498))
|
||||||
|
override.denied.add(Permission.MESSAGE_READ)
|
||||||
|
override.allowed.remove(Permission.MESSAGE_READ)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.message.contentStripped.contains("show")) {
|
||||||
|
if (event.message.mentionedChannels.isNotEmpty()) {
|
||||||
|
val override = event.message.mentionedChannels[0].getPermissionOverride(event.guild.getRoleById(499512961103167498))
|
||||||
|
override.allowed.add(Permission.MESSAGE_READ)
|
||||||
|
override.denied.remove(Permission.MESSAGE_READ)
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
/*event.channel.getMessageById(499929881883181064).queue {
|
||||||
|
it.editMessage("yote").queue()
|
||||||
|
it.addReaction("\uD83C\uDFB5").queue()
|
||||||
|
it.addReaction("\uD83D\uDCBE").queue()
|
||||||
|
it.addReaction("\uD83D\uDCF8").queue()
|
||||||
|
it.addReaction("\uD83C\uDFA8").queue()
|
||||||
|
it.addReaction("\uD83D\uDD0D").queue()
|
||||||
|
it.editMessage(MessageBuilder().append("**Pick a role:**\n").append(event.message.guild.getRoleById(499925623188488192)).append(
|
||||||
|
": \uD83C\uDFB5\n").append(event.guild.getRoleById(499525260912361472)).append(": \uD83D\uDCBE\n")
|
||||||
|
.append(event.guild.getRoleById(499525337034653707)).append(": \uD83D\uDCF8\n")
|
||||||
|
.append(event.guild.getRoleById(499525305405276181)).append(": \uD83C\uDFA8\n")
|
||||||
|
.append(event.guild.getRoleById(499525364708540416)).append(": \uD83D\uDD0D\n").build()
|
||||||
|
).queue()
|
||||||
|
|
||||||
|
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -69,4 +69,5 @@ fun main(args: Array<String>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
val bot = JDABuilder(args[0]).setStatus(OnlineStatus.ONLINE).setGame(Game.watching("fraud")).addEventListener(Events).build()
|
val bot = JDABuilder(args[0]).setStatus(OnlineStatus.ONLINE).setGame(Game.watching("fraud")).addEventListener(Events).build()
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in a new issue