forked from Bentechy66/werewolves-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreactions.py
57 lines (48 loc) · 1.66 KB
/
reactions.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
import discord
import asyncio
from discord.ext import commands
import botobject
bot = botobject.bot
channelid = "303113715773997056"
@bot.command()
async def rbr(messageid):
# msgchannel = bot.get_channel(channelid)
# msg = await bot.get_message(msgchannel, str(messageid))
# users = list(bot.get_all_members())
# for reaction in msg.reactions:
# for user in users:
# roles = []
# for role in user.roles:
# roles.append(role.name)
# if "RemoveReactions" in roles:
# await bot.remove_reaction(msg, reaction.emoji, user)
# else:
# pass
await rbrserv(messageid)
@bot.command()
async def register(messageid):
registered.append(messageid)
@bot.command()
async def unregister(messageid):
registered.remove(messageid)
async def reaction_background_service():
await bot.wait_until_ready()
while not bot.is_closed:
for id in registered:
re = await rbrserv(id)
await asyncio.sleep(5)
async def rbrserv(messageid):
msgchannel = bot.get_channel(channelid)
msg = await bot.get_message(msgchannel, str(messageid))
users = list(bot.get_all_members())
for reaction in msg.reactions:
for user in users:
roles = []
for role in user.roles:
roles.append(role.name)
if "RemoveReactions" in roles:
await bot.remove_reaction(msg, reaction.emoji, user)
else:
pass
registered = []
bot.loop.create_task(reaction_background_service())