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
|
from discord.ext import commands
import discord
import re
import importlib
import utils
importlib.reload(utils)
class Requests(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
async def dr(self, ctx, *args):
"""WIP."""
request_data = {"dinosaurs": ["herrerasaurus", "austroraptor", "baryonyx", "albertosaurus", "acrocanthosaurus", "stegosaurus", "ankylosaurus", "therizinosaurus", "avaceratops", "velociraptor", "orodromeus", "psittacosaurus"],
"genders": ["m", "f"],
"safe_logged": ["y", "n"],
"steamid": ""}
if len(args) != len(request_data):
await ctx.send(content=f"args:{len(args)}, data:{len(request_data)}")
return
for i, field in enumerate(request_data):
print(f"data:{field} field:{request_data[field]} type:{type(request_data[field])}")
if not any(args[i].casefold() == cur_arg for cur_arg in request_data[field]):
emb = await utils.embed(ctx, "Command failed", "Command should be structured as followed: `!dr [steamid] [dinosaur] [M/F] [Y/N]`")
emb = await utils.field(emb, "Dinosaurs", ", ".join(request_data[field]))
await ctx.send(content=f"Failed on {field}", embed=emb)
return
await ctx.send(content="Yes")
# if len(args) == arg_count:
# dinosaur = args[1]
# gender = args[2]
# safe_logged = args[3]
# steamid = args[0]
#
# dino_check = any(dinosaur.casefold() == dino for dino in lst_dino)
# print(f"Dino check: {dino_check}")
# else:
# emb = await utils.embed(ctx, "Command failed", "Command should be structured as followed: `!dr [steamid] [dinosaur] [M/F] [Y/N]`")
# emb = await utils.field(emb, "Dinosaurs", ", ".join(lst_dino))
# await ctx.send()
# print("Improper args")
# validate steamid
def setup(bot):
print("INFO: Loading [Requests]... ", end="")
bot.add_cog(Requests(bot))
print("Done!")
def teardown(bot):
print("INFO: Unloading [Requests]")
|