Skip to content

Instantly share code, notes, and snippets.

@iggyvolz
Created February 23, 2020 23:37
Show Gist options
  • Save iggyvolz/dddbb80372d59133d3ea1102b5fe43b2 to your computer and use it in GitHub Desktop.
Save iggyvolz/dddbb80372d59133d3ea1102b5fe43b2 to your computer and use it in GitHub Desktop.
Pronouns bot
local client = require('discordia').Client()
local allowableRoles = {{"681281731869147208", "He/Him"}, {"681281755080294443", "She/Her"}, {"681281780220690520", "They/Them"}}
client:on('messageCreate', function(message)
for i=1,3 do
local id, name = unpack(allowableRoles[i])
if message.content == "!pronouns "..name then
local member = message.member
if not member then break end
if member:hasRole(id) then
member:removeRole(id)
message:reply("Removed role "..name)
else
member:addRole(id)
message:reply("Added role "..name)
end
end
end
end)
client:run('Bot (BOT TOKEN)')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment