zephyr123

YanDev's autoban filter #2

Apr 26th, 2020
1,075
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.97 KB | None | 0 0
  1. # uncompyle6 version 3.6.4
  2. # Python bytecode 3.7 (3394)
  3. # Decompiled from: Python 2.7.17 (default, Apr 15 2020, 17:20:14)
  4. # [GCC 7.5.0]
  5. # Warning: this version has problems handling the Python 3 byte type in contants properly.
  6.  
  7. # Embedded file name: C:\Users\joelt\Desktop\midori-bot\cogs\autobanyoutube.py
  8. # Size of source mod 2**32: 1598 bytes
  9. import asyncio, json, discord
  10. from discord.ext import commands
  11. from discord.ext.commands import BucketType
  12. from io import BytesIO
  13. from utils import checks, autobanfilter
  14. ytbanned_words = autobanfilter.bannedlinksyt
  15.  
  16. class autobanyoutube(commands.Cog):
  17.  
  18.     def __init__(self, bot):
  19.         self.bot = bot
  20.  
  21.     @commands.Cog.listener()
  22.     async def on_message(self, ban1):
  23.         try:
  24.             if ban1.author.guild_permissions.ban_members:
  25.                 return
  26.                 channel = self.bot.get_channel(665147416688721921L)
  27.                 if 'youtube.com' in ban1.content.lower():
  28.                     if any((word in ban1.content for word in ytbanned_words)):
  29.                         await asyncio.sleep(0.3)
  30.                         try:
  31.                             await ban1.author.ban(reason='Posting a gremlin link. ~MidoriBot')
  32.                             await channel.send('Banned that motherfucker! (Posted gremlin links)')
  33.                         except:
  34.                             return
  35.  
  36.                 if 'youtu.be' in ban1.content.lower():
  37.                     if any((word in ban1.content for word in ytbanned_words)):
  38.                         await asyncio.sleep(0.3)
  39.                         try:
  40.                             await ban1.author.ban(reason='Posting a gremlin link. ~MidoriBot')
  41.                             await channel.send('Banned that motherfucker! (Posted gremlin links)')
  42.                         except:
  43.                             return
  44.  
  45.             else:
  46.                 return
  47.         except:
  48.             return
  49.  
  50.  
  51. def setup(bot):
  52.     bot.add_cog(autobanyoutube(bot))
Add Comment
Please, Sign In to add comment