lunarflu HF staff commited on
Commit
ecceb72
1 Parent(s): ba637be

Synced repo using 'sync_with_huggingface' Github Action

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -83,7 +83,7 @@ async def on_message(message):
83
  cooldown_duration = 5 # messages per n seconds, was 1, now 3, could try 5
84
  false_positive_threshold = 5 # big = alert less (catch less spam), small = alert more (catch more spam)
85
  timeout_threshold = 10 # number of messages before issuing a timeout (similar function to ban, easier to reverse)
86
- timeout_duration = 604800 # timeout duration in seconds (1 week)
87
 
88
  if message.author.id not in user_cooldowns:
89
  user_cooldowns[message.author.id] = {'count': 1, 'timestamp': message.created_at}
@@ -132,9 +132,9 @@ async def on_message(message):
132
 
133
  # timeout for a week
134
  if spam_count >= timeout_threshold:
135
- user = message.author
136
- await user.send("You have been temporarily timed out (7 Days) for spamming. If this was an error, message <@811235357663297546> or an `@admin`")
137
- await user.timeout(datetime.timedelta(seconds=timeout_duration), reason="Spamming")
138
  # reset spam count and timestamp
139
  user_cooldowns[message.author.id] = {'count': 0, 'timestamp': message.created_at}
140
  print(f"{bot.user} timed out {message.author} for {timeout_duration} for Spam")
 
83
  cooldown_duration = 5 # messages per n seconds, was 1, now 3, could try 5
84
  false_positive_threshold = 5 # big = alert less (catch less spam), small = alert more (catch more spam)
85
  timeout_threshold = 10 # number of messages before issuing a timeout (similar function to ban, easier to reverse)
86
+ timeout_duration = 168 # timeout duration in hours (1 week)
87
 
88
  if message.author.id not in user_cooldowns:
89
  user_cooldowns[message.author.id] = {'count': 1, 'timestamp': message.created_at}
 
132
 
133
  # timeout for a week
134
  if spam_count >= timeout_threshold:
135
+ member = message.author
136
+ await member.send("You have been temporarily timed out (7 Days) for spamming. If this was an error, message <@811235357663297546> or an `@admin`")
137
+ await member.timeout(datetime.timedelta(hours=timeout_duration), reason="Spamming")
138
  # reset spam count and timestamp
139
  user_cooldowns[message.author.id] = {'count': 0, 'timestamp': message.created_at}
140
  print(f"{bot.user} timed out {message.author} for {timeout_duration} for Spam")