Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
nickname stuff
Browse files
app.py
CHANGED
@@ -75,15 +75,13 @@ async def on_message_edit(before, after):
|
|
75 |
embed.add_field(name="Message Created On", value=convert_to_timezone(before.created_at, zurich_tz), inline=True)
|
76 |
embed.add_field(name="Message ID", value=before.id, inline=True)
|
77 |
embed.add_field(name="Message Jump URL", value=f"[Jump to message!](https://discord.com/channels/{before.guild.id}/{before.channel.id}/{before.id})", inline=True)
|
78 |
-
|
79 |
if before.attachments:
|
80 |
attachment_urls = "\n".join([attachment.url for attachment in before.attachments])
|
81 |
embed.add_field(name="Attachments", value=attachment_urls, inline=False)
|
82 |
-
|
83 |
#embed.set_footer(text=f"{datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S UTC')}")
|
84 |
embed.set_footer(text=f"{convert_to_timezone(datetime.utcnow(), zurich_tz)}")
|
85 |
-
|
86 |
await bot.log_channel.send(embed=embed)
|
|
|
87 |
except Exception as e:
|
88 |
print(f"Error: {e}")
|
89 |
|
@@ -103,15 +101,13 @@ async def on_message_delete(message):
|
|
103 |
embed.add_field(name="Message Created On", value=convert_to_timezone(message.created_at, zurich_tz), inline=True)
|
104 |
embed.add_field(name="Message ID", value=message.id, inline=True)
|
105 |
embed.add_field(name="Message Jump URL", value=f"[Jump to message!](https://discord.com/channels/{message.guild.id}/{message.channel.id}/{message.id})", inline=True)
|
106 |
-
|
107 |
if message.attachments:
|
108 |
attachment_urls = "\n".join([attachment.url for attachment in message.attachments])
|
109 |
embed.add_field(name="Attachments", value=attachment_urls, inline=False)
|
110 |
-
|
111 |
#embed.set_footer(text=f"{datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S UTC')}")
|
112 |
embed.set_footer(text=f"{convert_to_timezone(datetime.utcnow(), zurich_tz)}")
|
113 |
-
|
114 |
await bot.log_channel.send(embed=embed)
|
|
|
115 |
except Exception as e:
|
116 |
print(f"Error: {e}")
|
117 |
|
@@ -119,23 +115,21 @@ async def on_message_delete(message):
|
|
119 |
@bot.event
|
120 |
async def on_member_update(before, after):
|
121 |
try:
|
122 |
-
|
123 |
if before.name != after.name:
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
await bot.log_channel.send(embed=embed)
|
128 |
-
"""
|
129 |
-
|
130 |
if before.nick != after.nick:
|
131 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
|
133 |
-
if before.discriminator != after.discriminator:
|
134 |
-
print(f"Discriminator changed for {after.mention}: {before.discriminator} -> {after.discriminator}")
|
135 |
-
|
136 |
-
|
137 |
-
async for entry in before.guild.audit_logs(limit=5):
|
138 |
-
print(f'{entry.user} did {entry.action} to {entry.target}')
|
139 |
except Exception as e:
|
140 |
print(f"Error: {e}")
|
141 |
|
@@ -143,6 +137,10 @@ async def on_member_update(before, after):
|
|
143 |
@bot.event
|
144 |
async def on_member_ban(guild, user):
|
145 |
try:
|
|
|
|
|
|
|
|
|
146 |
# member banned from the guild
|
147 |
embed = Embed(description=f'Member {user.mention} was banned from the guild', color=Color.red())
|
148 |
await bot.log_channel.send(embed=embed)
|
|
|
75 |
embed.add_field(name="Message Created On", value=convert_to_timezone(before.created_at, zurich_tz), inline=True)
|
76 |
embed.add_field(name="Message ID", value=before.id, inline=True)
|
77 |
embed.add_field(name="Message Jump URL", value=f"[Jump to message!](https://discord.com/channels/{before.guild.id}/{before.channel.id}/{before.id})", inline=True)
|
|
|
78 |
if before.attachments:
|
79 |
attachment_urls = "\n".join([attachment.url for attachment in before.attachments])
|
80 |
embed.add_field(name="Attachments", value=attachment_urls, inline=False)
|
|
|
81 |
#embed.set_footer(text=f"{datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S UTC')}")
|
82 |
embed.set_footer(text=f"{convert_to_timezone(datetime.utcnow(), zurich_tz)}")
|
|
|
83 |
await bot.log_channel.send(embed=embed)
|
84 |
+
|
85 |
except Exception as e:
|
86 |
print(f"Error: {e}")
|
87 |
|
|
|
101 |
embed.add_field(name="Message Created On", value=convert_to_timezone(message.created_at, zurich_tz), inline=True)
|
102 |
embed.add_field(name="Message ID", value=message.id, inline=True)
|
103 |
embed.add_field(name="Message Jump URL", value=f"[Jump to message!](https://discord.com/channels/{message.guild.id}/{message.channel.id}/{message.id})", inline=True)
|
|
|
104 |
if message.attachments:
|
105 |
attachment_urls = "\n".join([attachment.url for attachment in message.attachments])
|
106 |
embed.add_field(name="Attachments", value=attachment_urls, inline=False)
|
|
|
107 |
#embed.set_footer(text=f"{datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S UTC')}")
|
108 |
embed.set_footer(text=f"{convert_to_timezone(datetime.utcnow(), zurich_tz)}")
|
|
|
109 |
await bot.log_channel.send(embed=embed)
|
110 |
+
|
111 |
except Exception as e:
|
112 |
print(f"Error: {e}")
|
113 |
|
|
|
115 |
@bot.event
|
116 |
async def on_member_update(before, after):
|
117 |
try:
|
118 |
+
"""
|
119 |
if before.name != after.name:
|
120 |
+
async for entry in before.guild.audit_logs(limit=5):
|
121 |
+
print(f'{entry.user} did {entry.action} to {entry.target}')
|
122 |
+
"""
|
|
|
|
|
|
|
123 |
if before.nick != after.nick:
|
124 |
+
embed = Embed(color=Color.orange())
|
125 |
+
embed.set_author(name=f"{after} ID: {after.id}", icon_url=after.avatar.url)
|
126 |
+
embed.title = "Nickname Modified"
|
127 |
+
embed.add_field(name="Mention", value=after.mention, inline=True)
|
128 |
+
embed.add_field(name="Old", value=before.nick, inline=True)
|
129 |
+
embed.add_field(name="New", value=after.nick, inline=True)
|
130 |
+
embed.set_footer(text=f"{convert_to_timezone(datetime.utcnow(), zurich_tz)}")
|
131 |
+
await bot.log_channel.send(embed=embed)
|
132 |
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
except Exception as e:
|
134 |
print(f"Error: {e}")
|
135 |
|
|
|
137 |
@bot.event
|
138 |
async def on_member_ban(guild, user):
|
139 |
try:
|
140 |
+
"""
|
141 |
+
async for entry in before.guild.audit_logs(limit=5):
|
142 |
+
print(f'{entry.user} did {entry.action} to {entry.target}') (and add reason if it exists)
|
143 |
+
"""
|
144 |
# member banned from the guild
|
145 |
embed = Embed(description=f'Member {user.mention} was banned from the guild', color=Color.red())
|
146 |
await bot.log_channel.send(embed=embed)
|