Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
adding auto ban
Browse files
app.py
CHANGED
|
@@ -129,27 +129,16 @@ async def on_message(message):
|
|
| 129 |
f"Message content: {message.content}\n"
|
| 130 |
f"[Jump to message!](https://discord.com/channels/{message.guild.id}/{message.channel.id}/{message.id})\n"
|
| 131 |
)
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
# timeout for a week
|
| 135 |
if spam_count >= timeout_threshold:
|
| 136 |
try:
|
| 137 |
member = message.author
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
await member.
|
| 142 |
except Exception as e:
|
| 143 |
-
print(f"Error: {e}")
|
| 144 |
-
|
| 145 |
-
# reset spam count and timestamp
|
| 146 |
-
user_cooldowns[message.author.id] = {'count': 0, 'timestamp': message.created_at}
|
| 147 |
-
print(f"{bot.user} timed out {message.author} for {timeout_duration} for Spam")
|
| 148 |
-
await bot.log_channel.send(f" {alert} {bot.user} timed out {message.author} for {timeout_duration} for Spam")
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
"""
|
| 152 |
-
|
| 153 |
|
| 154 |
user_cooldowns[message.author.id]['timestamp'] = message.created_at
|
| 155 |
|
|
|
|
| 129 |
f"Message content: {message.content}\n"
|
| 130 |
f"[Jump to message!](https://discord.com/channels/{message.guild.id}/{message.channel.id}/{message.id})\n"
|
| 131 |
)
|
| 132 |
+
# auto-ban
|
|
|
|
|
|
|
| 133 |
if spam_count >= timeout_threshold:
|
| 134 |
try:
|
| 135 |
member = message.author
|
| 136 |
+
await member.send(
|
| 137 |
+
"You have been auto-banned for spamming. \n If this was an error, message <@811235357663297546> ."
|
| 138 |
+
)
|
| 139 |
+
await member.ban()
|
| 140 |
except Exception as e:
|
| 141 |
+
print(f"Error: {e}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
|
| 143 |
user_cooldowns[message.author.id]['timestamp'] = message.created_at
|
| 144 |
|