zephyr123

YanDev's Autoban message

Apr 27th, 2020
2,593
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.61 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\aoi-bot\cogs\autobanmessage.py
  8. # Size of source mod 2**32: 3556 bytes
  9. import discord, asyncio, discord
  10. from asyncio import sleep
  11. from discord.ext import commands
  12. from discord.ext.commands import BucketType
  13. from discord.utils import get
  14. from utils import filters, checks
  15. from utils.filters import *
  16. import os, json
  17. from urllib.request import urlopen, Request, urlretrieve, URLopener
  18. import requests
  19. user_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7'
  20. headers = {'User-Agent': user_agent}
  21.  
  22. class Autobanmessage(commands.Cog):
  23.  
  24.     def __init__(self, bot):
  25.         self.bot = bot
  26.         self.channel = self.bot.get_channel(685446255681339428L)
  27.         self.ban_reasons = {'link':'Posting a gremlin link. ~AoiBot',
  28.          'ytlink':'Posting a gremlin youtube video. ~AoiBot',
  29.          'badword':'Saying a banned phrase (Are you coding, racial, etc) ~AoiBot',
  30.          'milk':'Milk emoji ~AoiBot',
  31.          'name':'Illegal name',
  32.          'forceban':'Force ban: troll in #mission-mode ~AoiBot'}
  33.  
  34.     @commands.Cog.listener()
  35.     async def on_message(self, message):
  36.         """
  37.        checking for explicit content in messages and then banning
  38.        """
  39.         try:
  40.             if message.author.guild_permissions.ban_members:
  41.                 return
  42.             if message.author.bot:
  43.                 return
  44.         except:
  45.             return
  46.         else:
  47.             await sleep(0.1)
  48.             if 'braincell' in message.content.lower():
  49.                 return
  50.             if mission_re.search(message.content):
  51.                 if message.channel.id == 679263796371521537L:
  52.                     await message.author.ban(reason=(self.ban_reasons['forceban']))
  53.                     return
  54.             if links_re.search(message.content):
  55.                 await message.author.ban(reason=(self.ban_reasons['link']))
  56.                 return
  57.             if yt_links_re.search(message.content):
  58.                 await message.author.ban(reason=(self.ban_reasons['ytlink']))
  59.                 return
  60.             if milk_re.search(message.content):
  61.                 await message.author.ban(reason=(self.ban_reasons['milk']))
  62.                 return
  63.             if words_re.search(message.content):
  64.                 await message.author.ban(reason=(self.ban_reasons['badword']))
  65.                 return
  66.             if slurs_re.search(message.content):
  67.                 await message.author.ban(reason=(self.ban_reasons['badword']))
  68.                 return
  69.  
  70.     @commands.Cog.listener()
  71.     async def on_member_join(self, member):
  72.         await sleep(0.1)
  73.         if words_re.search(member.display_name) or milk_re.search(member.display_name):
  74.             await member.ban(reason=f"Innapropriate username ({member.name}) ~AoiBot")
  75.         else:
  76.             if slurs_re.search(member.display_name):
  77.                 await member.ban(reason=f"Racial slur in username ({member.name}) ~AoiBot")
  78.  
  79.     @commands.Cog.listener()
  80.     async def on_member_ban--- This code section failed: ---
  81.  
  82.   90         0  LOAD_CONST               None
  83.              2  RETURN_VALUE    
  84.  
  85.   98         4  WITH_CLEANUP_START
  86.              6  WITH_CLEANUP_FINISH
  87.              8  END_FINALLY      
  88.  
  89. Parse error at or near `WITH_CLEANUP_START' instruction at offset 4
  90.  
  91.  
  92. def setup(bot):
  93.    bot.add_cog(Autobanmessage(bot))
Advertisement
Add Comment
Please, Sign In to add comment