-
Notifications
You must be signed in to change notification settings - Fork 0
/
tokei-minna.lua
63 lines (63 loc) · 1.4 KB
/
tokei-minna.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
local discordia = require('discordia')
local client = discordia.Client()
local json = require('json.json')
local trim = function(s)
return s:match('^%s*(.-)%s*$')
end
local stretch_table = function(t)
local r = {}
for i = 1, 11 do
for k,v in pairs(t) do
r[#r + 1] = v
end
end
return r
end
client:on('ready', function()
print('\'tokei-minna\' ajimemashita: ' .. client.user.username)
end)
local parsemsg = function(message)
if (message.content:match('@everyone')) or (message.content:match('@here')) then
message:addReaction('🍆')
message:addReaction('🈁')
message:addReaction('🈂')
message:addReaction('🈷')
message:addReaction('🈶')
message:addReaction('🈯')
message:addReaction('🉐')
message:addReaction('🈹')
message:addReaction('🈚')
message:addReaction('🈲')
message:addReaction('🉑')
message:addReaction('🈸')
message:addReaction('🈴')
message:addReaction('🈳')
message:addReaction('㊗')
message:addReaction('㊙')
message:addReaction('🈺')
message:addReaction('🈵')
message:addReaction('🅰')
message:addReaction('🅱')
end
end
client:on('messageCreate', function(message)
local s, r = pcall(parsemsg, message)
if not (s) then
print('Erae')
end
end)
do
local token
do
local fp = io.open('./tokei-minna.txt', 'rb')
if not (fp) then
e = io.open('./log.txt', 'a+')
e:write('Erae: mitsukarimasen Token\n\n')
e:close()
return
end
token = trim(fp:read('*a'))
fp:close()
end
client:run(token)
end