-
Notifications
You must be signed in to change notification settings - Fork 3
/
luna.lua
66 lines (47 loc) · 1.25 KB
/
luna.lua
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
54
55
56
57
58
59
60
61
62
63
64
65
66
local fs = require('fs')
local json = require('json')
local discordia = require('discordia')
local cfg = json.decode(fs.readFileSync('config.json'))
local loader = require('./loader')
local modules = loader.modules
loader.loadAll()
local client = discordia.Client {
cacheAllMembers = true,
}
local e = discordia.enums.gatewayIntent
client:enableAllIntents()
client:disableIntents(e.guildMessageTyping)
client:disableIntents(e.directMessageTyping)
local clock = discordia.Clock()
clock:on('hour', function()
if modules.pooper then
modules.pooper(client)
end
end)
client:once('ready', function()
print('Ready: ' .. client.user.tag)
clock:start()
end)
client:on('messageCreate', function(msg)
local author = msg.author
if author.bot and author.discriminator ~= '0000' then return end
if author == client.user then return end
if not msg.guild then
return client.owner:sendf('%s said: %s', author.mentionString, msg.content)
end
if modules.commands then
modules.commands.onMessageCreate(msg)
end
if modules.antispam then
modules.antispam(msg)
end
end)
client:on('messageDelete', function(msg)
if modules.commands then
modules.commands.onMessageDelete(msg)
end
if modules.undelete then
modules.undelete(msg)
end
end)
client:run(cfg.token)