forked from nh-server/Kurisu
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add missing intent and move events log autoban by scamming sites
- Loading branch information
1 parent
3f7d3ce
commit ebaec93
Showing
2 changed files
with
33 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,6 +74,15 @@ def highlight_matches(self, matches: List[re.Match], message: str) -> str: | |
channel_antispam = {} | ||
help_notice_anti_repeat = [] | ||
|
||
async def userbot_yeeter_pop(self, message): | ||
await asyncio.sleep(20) | ||
self.userbot_yeeter[message.author.id].remove(message.channel) | ||
try: | ||
if len(self.userbot_yeeter[message.author.id]) == 0: | ||
self.userbot_yeeter.pop(message.author.id) | ||
except KeyError: | ||
pass | ||
|
||
async def scan_message(self, message, is_edit=False): | ||
random.seed(message.id) | ||
embed = discord.Embed(color=utils.gen_color(message.id)) | ||
|
@@ -253,6 +262,29 @@ async def scan_message(self, message, is_edit=False): | |
if contains_video and message.channel in self.bot.assistance_channels: | ||
await self.bot.channels['message-logs'].send( | ||
f"▶️ **Video posted**: {message.author.mention} posted a video in {message.channel.mention}\n------------------\n{message.clean_content}") | ||
|
||
if contains_scamming_site_levenshtein or contains_scamming_site: | ||
if message.author.id not in self.userbot_yeeter: | ||
self.userbot_yeeter[message.author.id] = [] | ||
if message.channel not in self.userbot_yeeter[message.author.id]: | ||
self.userbot_yeeter[message.author.id].append(message.channel) | ||
if len(self.userbot_yeeter[message.author.id]) == 2: | ||
msg = ("You have been banned from Nintendo Homebrew for linking scamming sites in multiple channels. " | ||
"If you think this is a mistake contact ❅FrozenFire❆#0700 on discord or send a email to [email protected]") | ||
await utils.send_dm_message(message.author, msg) | ||
self.bot.actions.append('wb:' + str(message.author.id)) | ||
await message.author.ban(reason="Linking scamming links in multiple channels.") | ||
log_msg = f"⛔ **Auto-ban**: {message.author.mention} banned for spamming scamming sites | {message.author}\n🗓 __Creation__: {message.author.created_at}\n🏷 __User ID__: {message.author.id}" | ||
await self.bot.channels['mod-logs'].send(log_msg) | ||
await self.bot.channels['mods'].send(log_msg) | ||
try: | ||
await message.delete() | ||
except discord.errors.NotFound: | ||
pass | ||
return | ||
else: | ||
self.bot.loop.create_task(self.userbot_yeeter_pop(message)) | ||
|
||
if contains_scamming_site: | ||
embed.description = self.highlight_matches(contains_scamming_site, msg) | ||
try: | ||
|
@@ -319,27 +351,6 @@ async def scan_message(self, message, is_edit=False): | |
await crud.add_permanent_role(message.author.id, self.bot.roles['Probation'].id) | ||
await message.author.add_roles(self.bot.roles['Probation']) | ||
|
||
if contains_scamming_site_levenshtein or contains_scamming_site: | ||
if message.author.id not in self.userbot_yeeter: | ||
self.userbot_yeeter[message.author.id] = [] | ||
if message.channel in self.userbot_yeeter[message.author.id]: | ||
return | ||
self.userbot_yeeter[message.author.id].append(message.channel) | ||
if len(self.userbot_yeeter[message.author.id]) == 2: | ||
msg = ("You have been banned from Nintendo Homebrew for linking scamming sites in multiple channels. " | ||
"If you think this is a mistake contact ❅FrozenFire❆#0700 on discord or send a email to [email protected]") | ||
await utils.send_dm_message(message.author, msg) | ||
await message.author.ban(reason="Linking scamming links in multiple channels.") | ||
log_msg = f"🔇 **Auto-banned**: {message.author.mention} banned for spamming scamming sites| {message.author}\n🗓 __Creation__: {message.author.created_at}\n🏷 __User ID__: {message.author.id}" | ||
await self.bot.channels['mod-logs'].send(log_msg) | ||
await asyncio.sleep(20) | ||
self.userbot_yeeter[message.author.id].remove(message.channel) | ||
try: | ||
if len(self.userbot_yeeter[message.author.id]) == 0: | ||
self.userbot_yeeter.pop(message.author.id) | ||
except KeyError: | ||
pass | ||
|
||
async def user_spam_check(self, message): | ||
if message.author.id not in self.user_antispam: | ||
self.user_antispam[message.author.id] = [] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters