-
Notifications
You must be signed in to change notification settings - Fork 9
/
bot.py
285 lines (254 loc) · 9.52 KB
/
bot.py
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
import discord
import csv
import re
import random
import Cota.cota
import tlp.tlp
import sevensibs.sevens
import bob.bob
import trtr.trtr
import vq.vq
import vba.vba
import fourkings.fourkings
import dow.dow
import sp.sp
import dlatmol.dlatmol
import burger.burger
import ee.ee
import fehr.fehr
import john.john
import don.don
import avt.avt
import oc.oc
import auc.auc
import cc.cc
import tmgc.tmgc
from discord.ext import commands
from discord import option
import sys
bot = discord.Bot()
#cota = cromar.create_subgroup("cota", "Get Call of the Armor data")
test_ids = [1039354532167176303]
public_test_ids = [1039354532167176303,1081749141480288256]
@bot.command(description="Call Cromar Bot and get a response.")
@option("input", description = "Format is [command] [hack] [name]")
async def cromar(ctx, input: str):
if (input == 'help'):
await help(ctx)
else:
parsedInput = input.split(" ", 2)
command = parsedInput[0]
hack = parsedInput[1]
name = parsedInput[2]
if (command == "unit"):
await unit(ctx, hack, name)
elif (command == "item"):
await item(ctx, hack, name)
elif (command == "skill"):
await skill(ctx, hack, name)
elif (command == "boss"):
await boss(ctx, hack, name)
else:
await ctx.response.send_message("That command does not exist.")
async def help(ctx):
unitembed=discord.Embed(title="Available commands", color=0x676b68)
unitembed.add_field(name='Invite Link', value='https://discord.com/api/oauth2/authorize?client_id=1039342081245724723&permissions=277025672192&scope=bot', inline=False)
unitembed.add_field(name="Hack Abbreviations", value="https://github.com/knabepicer/CromarBot/blob/main/Hack%20abbreviations.txt",inline=False)
unitembed.add_field(name='/cromar [command] [hack] [name]', value= "Alternative way to call bot- faster to type, but no autocorrect", inline=False)
unitembed.add_field(name='/unit [hack] [name]', value="Get unit data - currently supports 4k, 7s, auc, avt, bob, burger, cc, cota, dlatmol, dow, don, ee, fehr, john, oc, sp, tlp, tmgc, trtr, vq, vba", inline=False)
unitembed.add_field(name='/item [hack] [name]', value="Get item data - currently supports auc, bob, cc, don, oc", inline=False)
unitembed.add_field(name='/skill [hack] [name]', value="Get skill data - currently supports bob, vq, fehr", inline=False)
unitembed.add_field(name='/boss [hack] [name]', value="Get boss data - currently supports tlp", inline=False)
await ctx.response.send_message(embed=unitembed)
async def get_unit_names(ctx: discord.AutocompleteContext):
hack = ctx.options['hack']
if (hack == 'cota'):
return Cota.cota.get_unit_names(ctx)
elif (hack == 'tlp'):
return tlp.tlp.get_unit_names(ctx)
elif (hack == '7s'):
return sevensibs.sevens.get_unit_names(ctx)
elif (hack == 'bob'):
return bob.bob.get_unit_names(ctx)
elif (hack == 'trtr'):
return trtr.trtr.get_unit_names(ctx)
elif (hack == 'rtr'):
return trtr.trtr.get_unit_names(ctx)
elif (hack == 'vq'):
return vq.vq.get_unit_names(ctx)
elif (hack == 'vba'):
return vba.vba.get_unit_names(ctx)
elif (hack == '4k'):
return fourkings.fourkings.get_unit_names(ctx)
elif (hack == 'dow'):
return dow.dow.get_unit_names(ctx)
elif (hack == 'sp'):
return sp.sp.get_unit_names(ctx)
elif (hack == 'dlatmol'):
return dlatmol.dlatmol.get_unit_names(ctx)
elif (hack == 'burger'):
return burger.burger.get_unit_names(ctx)
elif (hack == 'ee'):
return ee.ee.get_unit_names(ctx)
elif (hack == 'fehr'):
return fehr.fehr.get_unit_names(ctx)
elif (hack == 'john'):
return john.john.get_unit_names(ctx)
elif (hack == 'don'):
return don.don.get_unit_names(ctx)
elif (hack == 'avt'):
return avt.avt.get_unit_names(ctx)
elif (hack == 'oc'):
return oc.oc.get_unit_names(ctx)
elif (hack == 'auc'):
return auc.auc.get_unit_names(ctx)
elif (hack == 'cc'):
return cc.cc.get_unit_names(ctx)
elif (hack == 'tmgc'):
return tmgc.tmgc.get_unit_names(ctx)
else:
return []
@bot.slash_command(description = "Get playable unit data")
@option("hack", description = "Name of the hack to get data for",
autocomplete=discord.utils.basic_autocomplete(
["4k","7s","avt","auc","bob","burger","cota","cc","dlatmol","don","dow","ee","fehr","john","oc", "sp","tlp","tmgc","trtr","vba","vq"]
))
@option("name", description = "Name of the character to get data for", autocomplete=get_unit_names)
async def unit(ctx, hack: str, name: str):
if (hack == 'cota'):
await Cota.cota.unit(ctx, name)
elif (hack == 'tlp'):
await tlp.tlp.unit(ctx, name)
elif (hack == '7s'):
await sevensibs.sevens.unit(ctx, name)
elif (hack == 'bob'):
await bob.bob.unit(ctx, name)
elif (hack == 'trtr'):
await trtr.trtr.unit(ctx, name)
elif (hack == 'rtr'):
await trtr.trtr.unit(ctx, name)
elif (hack == 'vq'):
await vq.vq.unit(ctx, name)
elif (hack == 'vba'):
await vba.vba.unit(ctx, name)
elif (hack == '4k'):
await fourkings.fourkings.unit(ctx, name)
elif (hack == 'dow'):
await dow.dow.unit(ctx, name)
elif (hack == 'sp'):
await sp.sp.unit(ctx, name)
elif (hack == 'dlatmol'):
await dlatmol.dlatmol.unit(ctx, name)
elif (hack == 'burger'):
await burger.burger.unit(ctx, name)
elif (hack == 'ee'):
await ee.ee.unit(ctx, name)
elif (hack == 'fehr'):
await fehr.fehr.unit(ctx, name)
elif (hack == 'john'):
await john.john.unit(ctx, name)
elif (hack == 'don'):
await don.don.unit(ctx, name)
elif (hack == 'avt'):
await avt.avt.unit(ctx, name)
elif (hack == 'oc'):
await oc.oc.unit(ctx, name)
elif (hack == 'auc'):
await auc.auc.unit(ctx, name)
elif (hack == 'cc'):
await cc.cc.unit(ctx, name)
elif (hack == 'tmgc'):
await tmgc.tmgc.unit(ctx, name)
else:
await ctx.response.send_message("That hack does not exist or is not supported by this command.")
async def get_boss_names(ctx: discord.AutocompleteContext):
hack = ctx.options['hack']
if (hack == 'tlp'):
return tlp.tlp.get_boss_names(ctx)
elif (hack == 'burger'):
return burger.burger.get_boss_names(ctx)
else:
return[]
@bot.slash_command(description = "Get boss unit data")
@option("hack", description = "Name of the hack to get data for",
autocomplete=discord.utils.basic_autocomplete(
["tlp", "burger"]
))
@option("name", description = "Name of the character to get data for", autocomplete= get_boss_names)
async def boss(ctx, hack: str, name: str):
if (hack == 'tlp'):
await tlp.tlp.boss(ctx, name)
elif (hack == 'burger'):
await burger.burger.boss(ctx, name)
else:
await ctx.response.send_message("That hack does not exist or is not supported by this command.")
async def get_item_names(ctx: discord.AutocompleteContext):
hack = ctx.options['hack']
if (hack == 'bob'):
return bob.bob.get_item_names(ctx)
elif (hack == 'don'):
return don.don.get_item_names(ctx)
elif (hack == 'auc'):
return auc.auc.get_item_names(ctx)
elif (hack == 'oc'):
return oc.oc.get_item_names(ctx)
elif (hack == 'cc'):
return cc.cc.get_item_names(ctx)
else:
return[]
@bot.slash_command(description = "Get item data")
@option("hack", description = "Name of the hack to get data for",
autocomplete=discord.utils.basic_autocomplete(
["auc","bob", "cc","don", "oc"]
))
@option("name", description = "Name of the item to get data for", autocomplete = get_item_names)
async def item(ctx, hack: str, name: str):
if (hack == 'bob'):
await bob.bob.item(ctx, name)
elif (hack == 'don'):
await don.don.item(ctx, name)
elif (hack == 'auc'):
await auc.auc.item(ctx, name)
elif (hack == 'oc'):
await oc.oc.item(ctx, name)
elif (hack == 'cc'):
await cc.cc.item(ctx, name)
else:
await ctx.response.send_message("That hack does not exist or is not supported by this command.")
async def get_skill_names(ctx: discord.AutocompleteContext):
hack = ctx.options['hack']
if (hack == 'bob'):
return bob.bob.get_skill_names(ctx)
elif (hack == 'vq'):
return vq.vq.get_skill_names(ctx)
elif (hack == 'fehr'):
return fehr.fehr.get_skill_names(ctx)
else:
return[]
@bot.slash_command(description = "Get skill data")
@option("hack", description = "Name of the hack to get data for",
autocomplete=discord.utils.basic_autocomplete(
["bob", 'vq', 'fehr']
))
@option("name", description = "Name of the skill to get data for", autocomplete=get_skill_names)
async def skill(ctx, hack: str, name: str):
if (hack == 'bob'):
await bob.bob.skill(ctx, name)
elif (hack == 'vq'):
await vq.vq.skill(ctx, name)
elif (hack == 'fehr'):
await fehr.fehr.skill(ctx, name)
else:
await ctx.response.send_message("That hack does not exist or is not supported by this command.")
#bot.load_extension("bob.bob")
#bot.load_extension("cota.cota")
#bot.load_extension("7s.sevens")
#bot.load_extension("trtr.trtr")
#bot.load_extension("tlp.tlp")
@bot.event
async def on_ready():
print("Ready!")
token = ''
with open('token.txt') as f:
token = f.read()
bot.run(token)