-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.lua
More file actions
53 lines (39 loc) · 1.24 KB
/
index.lua
File metadata and controls
53 lines (39 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
local discordia = require('discordia')
local client = discordia.Client()
discordia.extensions()
local commands = require('./commands.lua')
local config = require('./config.lua')
local checkData = require('./checkData.lua')
function wait(a)
local sec = tonumber(os.clock() + a);
while (os.clock() < sec) do
end
end
client:on('ready', function()
print('Logged in as '.. client.user.username)
client:setGame{ name = 'in ' .. #client.guilds .. ' servers | ' .. config.prefix .. 'help', type = 3 }
end)
client:on('messageCreate', function(message)
if author == client.user then return end
local id = message.author.id
checkData(id)
local content = message.content
local args = content:split(' ')
local command = nil
for name, cmd in pairs(commands) do
if args[1]:lower() == config.prefix .. name then
command = cmd
break
end
for _, a in pairs(cmd.aliases) do
if args[1]:lower() == config.prefix .. a then
command = cmd
break
end
end
end
if command then
command.callback(message, args)
end
end)
client:run('Bot ' .. config.token)