-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserverSettings.py
More file actions
34 lines (32 loc) 路 1.22 KB
/
Copy pathserverSettings.py
File metadata and controls
34 lines (32 loc) 路 1.22 KB
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
import shelve
import discord
import asyncio
from discord import Embed
async def serverSettings(message, url, client):
embedVar = Embed(title="Talking", description="Should Gaia be able to talk without being prompted?", color=0x8D1B80)
embedVar.add_field(name="Talkative!", value="馃槂", inline=True)
embedVar.add_field(name="Quiet", value="馃", inline=True)
mess = await message.channel.send(embed=embedVar)
e1 = "馃槂"
e2 = "馃"
await mess.add_reaction(e1)
await mess.add_reaction(e2)
def check(reaction, user):
return user != mess.author and reaction.message.id == mess.id and user == message.author
try:
reaction, user = await client.wait_for('reaction_add', timeout=90.0, check=check)
except asyncio.TimeoutError:
print("timed out")
else:
if reaction.emoji == e1:
talk = True
await message.channel.send("Gaia can now talk freely!")
elif reaction.emoji == e2:
talk = False
await message.channel.send("Gaia is gonna be quiet")
else:
talk = False
with shelve.open(url, writeback=True) as s:
ma = str(message.channel.guild.id)
s[ma] = talk
return talk