forked from taylorzhang2/chessbot
/
unused_code
88 lines (85 loc) · 3.16 KB
/
unused_code
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
"""
@bot.event
async def on_message(message):
game = bot.get_cog('Game')
if message == game.draw_message:
print("the message is game.draw_message!")
reactionlist = ['✅', '❌']
def check(reaction, user):
print('checking for reaction validity...')
return user == bot.get_user(game.opposingPlayer.id) and str(reaction) in reactionlist
try:
print('trying to wait for reaction...')
reaction, user = await bot.wait_for('reaction_add', timeout=20.0, check=check)
except asyncio.TimeoutError:
print('draw offer timed out...')
await game.draw_message.channel.send('Draw offer timed out.', delete_after=5)
else:
print('made it to the else block...')
if str(reaction) == reactionlist[0]:
await game.draw_message.delete()
embed_title = 'Game over. ' + str(game.player.username) + ' and ' + str(game.opposingPlayer.username) + ' have agreed to a draw.'
await game.Update_Message(ctx, embed_title=embed_title, edit=True)
self.Reset()
elif str(reaction) == reactionlist[1]:
await game.draw_message.delete()
await game.draw_message.channel.send('Draw offer declined.', delete_after=5)
"""
"""
@commands.command()
async def load(extension_name : str, ctx):
try:
bot.load_extension(extension_name)
except (AttributeError, ImportError) as e:
await ctx.send("'''py\n{}; {}\n'''".format(type(e).__name__, str(e)))
return
await ctx.send("{} loaded.".format(extension_name))
"""
"""
@client.event
async def on_ready():
guild = discord.utils.get(client.guilds, name=GUILD)
print(
f'{client.user} is connected to the following guild:\n'
f'{guild.name}(id: {guild.id})'
)
"""
"""
def eval(s,op):
lst = []
for i in s:
if i.isnumeric():
lst.append(int(i))
if op == 'add':
return sum(lst)
elif op == 'mult':
result = 1
for i in lst:
result *= i
return result
@client.event
async def on_message(message):
if message.author == client.user:
return
cmddict = {'greet':'Hi, ' + message.author.name + '!',
'gay':'no u',
'm!':'haha yes very funny',
'fuck':'wow haha i am dying of laughter',
'daily':'wrong prefix idiot. not tatsumaki smdh',
'':"that's not a command dumbass, that's the absence of a command. smdh",
'help':'Commands:\n\t1. greet (prints a greeting)\n\t2. gay (no u)\n\t3. add (adds ints in input)\n\t4. mult (multiplies ints in input)'}
prefix = 'm!'
if message.content[:len(prefix)] == prefix:
body = message.content[len(prefix):]
if body[:3] == 'add':
response = eval(message.content, 'add')
elif body[:4] == 'mult':
response = eval(message.content, 'mult')
elif body not in cmddict:
response = 'enter a valid command dumbass'
else:
response = cmddict[body]
await message.channel.send(response)
client.run(TOKEN)
#bot.run(TOKEN)
"""