lunarflu HF staff commited on
Commit
4e57539
1 Parent(s): d1c7f26

adding auto ban

Browse files
Files changed (1) hide show
  1. app.py +6 -17
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
- await guild.kick(member, reason="Spamming")
140
- #await member.send("You have been temporarily timed out (7 Days) for spamming. If this was an error, message <@811235357663297546> or an `@admin`")
141
- await member.timeout(datetime.timedelta(hours=timeout_duration), reason="Spamming")
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