-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathedit_message_handler.py
More file actions
33 lines (28 loc) · 1.21 KB
/
edit_message_handler.py
File metadata and controls
33 lines (28 loc) · 1.21 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
import discord
from database import ServerData, db
async def handle_editmessage(message: discord.Message, client: discord.Client, server_data: ServerData):
channel: discord.TextChannel = message.channel
author: discord.Member = message.author
await channel.send(
embed=discord.Embed(
color=discord.Color.gold(),
description="Ok please send me now the new message and i change it for you"))
def check(m):
if m.author.id == author.id and m.channel.id == channel.id:
return m
newmessage = await client.wait_for("message", check=check, timeout=None)
nmsg = newmessage.content
server_data.ruletext = nmsg
rules_channel_id = server_data.ruleschannel
rules_channel = client.get_channel(int(rules_channel_id))
new_message = await rules_channel.send(
embed=discord.Embed(
color=discord.Color.green(),
description=nmsg
).set_footer(
text="Please accept the rules with ✅ or decline them with ❌ "))
server_data.messageid = new_message.id
server_data.save()
db.commit()
await new_message.add_reaction("✅")
await new_message.add_reaction("❌")