-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.n
98 lines (85 loc) · 2.2 KB
/
run.n
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
import FileIO
import json
import times
let random = imp "./.testmods/random.n"
let imgen = imp "./.testmods/imgen.n"
let token = imp "./token.n"
let discord = imp "./discord.n"
let responses = {
..discord.responsesEmpty,
onReady: yes((self:discord.member.Member) -> cmd[()] {
print("Bot is up!")
}),
onMessage: yes((message:discord.message.Message) -> cmd[bool] {
if message.getSender().getId() == "799715319127736392" {
return false
}
print(message.getContent())
if message.getContent() == "ntest" {
let response = discord.sendMessage(message.getChannel(), yes("testing"), none, none, none, none, none)!
if response ~= 200 {
print("unable to send message")
}
}
if message.getContent() == "nimg" {
let rand = random.createRandom((times.getTime()! * 1000.0).round())
if let ok(val) = imgen.generateImage(
(rand.getNext() * 256.0).floor(),
(rand.getNext() * 256.0).floor(),
(rand.getNext() * 256.0).floor(),
)! {
let response = discord.sendMessage(message.getChannel(),
none,
none,
none,
none,
none,
yes([("test.png", "testing", val)])
)!
if response ~= 200 {
print("unable to send image")
}
}
}
if message.getContent() == "nembed" {
let rand = random.createRandom((times.getTime()! * 1000.0).round())
let response = discord.sendMessage(message.getChannel(), none, none, yes([
discord.embed.Embed(
yes("Testing"),
yes("This is a test"),
yes("https://ash.vin"),
yes(discord.color.Color(
(rand.getNext() * 256.0).floor(),
(rand.getNext() * 256.0).floor(),
(rand.getNext() * 256.0).floor(),
)),
)
]), none, none, none)!
if response ~= 200 {
print("unable to send embed")
}
}
if message.getContent() == "nexit" && message.getSender().getId() == "384499090865782785" {
print("exiting...")
return true
}
return false
}),
}
let presence = discord.status.Status(
none,
{
name: "the output logs",
type: discord.status.activity.WATCHING,
},
"online",
false
)
let self = () -> cmd[()] {
let mut key = FileIO.read(".token")! | ""
if key == "" {
key = token.KEY
}
print(discord.start(key, presence, responses)!)
}
let pub main = self()