-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathThe bot itself
143 lines (64 loc) · 4.07 KB
/
The bot itself
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
import discord, os, sys, time
title="Discord Bot: Server Smacker"
if os.name=="nt": os.system("title "+title)
else: sys.stdout.write("\x1b]2;"+title+"\x07")
scorelist={}
client=discord.Client()
@client.event
async def on_ready():
print('Logged in as')
print(client.user.name)
print(client.user.id)
print('------')
print(client)
@client.event
async def on_message(message):
if message.content.startswith("!ss"):
global scorelist
command=message.content[4:]
if message.server not in scorelist: scorelist[message.server]=[0, 1]
if str(message.server)=="ender_scythe's Discord Server":
if str(message.channel)=="games":
if command=="stats": await client.send_message(message.channel, "Server Smacker X by Xanman Gaming!\nScore: "+str(scorelist[message.server][0])+"\nScore per smack: "+str(scorelist[message.server][1]))
elif command=="buy":
score=scorelist[message.server][0]
if score>999999: score-=1000000; success=1; cost=1000000
elif score>9999: score-=10000; success=1; cost=10000
elif score>999: score-=1000; success=1; cost=1000
elif score>499: score-=500; success=1; cost=500
elif score>99: score-=100; success=1; cost=100
elif score>49: score-=50; success=1; cost=50
elif score>9: score-=10; success=1; cost=10
else: success=0
if success==1:
scorelist[message.server][0]-=cost
scorelist[message.server][1]+=cost//10
await client.send_message(message.channel, str(message.author)+" bought an upgrade for "+str(cost)+" points!\nScore per smack now "+str(scorelist[message.server][1])+"!")
else: await client.send_message(message.channel, str(message.author)+" tried to buy an upgrade, but the server doesn't have enough points!")
else:
scorelist[message.server][0]+=scorelist[message.server][1]
await client.send_message(message.channel, str(message.author)+" just smacked the server for "+str(scorelist[message.server][1])+" points!\nScore now "+str(scorelist[message.server][0])+"!")
else:
if command=="stats": await client.send_message(message.channel, "Server Smacker X by Xanman Gaming!\nScore: "+str(scorelist[message.server][0])+"\nScore per smack: "+str(scorelist[message.server][1]))
elif command=="buy":
score=scorelist[message.server][0]
if score>999999: score-=1000000; success=1; cost=1000000
elif score>9999: score-=10000; success=1; cost=10000
elif score>999: score-=1000; success=1; cost=1000
elif score>499: score-=500; success=1; cost=500
elif score>99: score-=100; success=1; cost=100
elif score>49: score-=50; success=1; cost=50
elif score>9: score-=10; success=1; cost=10
else: success=0
if success==1:
scorelist[message.server][0]-=cost
scorelist[message.server][1]+=add
await client.send_message(message.channel, str(message.author)+" bought an upgrade for "+str(cost)+" points!\nScore per smack now "+str(scorelist[message.server][1])+"!")
else: await client.send_message(message.channel, str(message.author)+" tried to buy an upgrade, but the server doesn't have enough points!")
else:
scorelist[message.server][0]+=scorelist[message.server][1]
await client.send_message(message.channel, str(message.author)+" just slapped the server for "+str(scorelist[message.server][1])+" points!\nScore now "+str(scorelist[message.server][0])+"!")
#if time.time()-start>1:
# score+=incscoreauto
# start=time.time()
client.run("MjU3MzY1MTIzMTQyNzc4ODgw.Cy5peQ.m4uDD48x2GkApPUHFtjceNC9LVM")