Closed papaj2139 closed 2 years ago
if not member then
-- The user have not mentioned any member to be banned
message:reply("Please mention a member to ban!")
return
elseif not author:hasPermission("banMembers") then
-- The user does not have enough permissions
message:reply("You do not have `banMembers` permissions!")
return
end
for user in message.mentionedUsers:iter() do
-- Check if mention isn't a reply
if string.find(message.content, "<@[!]?" .. user.id .. ">") then
member = message.guild:getMember(user.id)
if author.highestRole.position > member.highestRole.position then
member:ban()
end
end
end
You just forgot an end :) lmk if that fixed it!
code: local discordia = require('discordia') local client = discordia.Client()
client:on('ready', function() print('Logged in as '.. client.user.username) end)
client:on('messageCreate', function(message) if message.author.bot then return end if message.content == '$ping' then message.channel:send('Pong!') end if message.content:sub(1, 4) == '$ban' then local author = message.guild:getMember(message.author.id) local member = message.mentionedUsers.first
end
client:run('My token')
error:lua: c:\Users\ojk\Desktop\discord\bots\minemaker\main.lua:37: 'end' expected (to close 'if' at line 13) near ''