Browse Source

block bots & when no send perms

master
drbot7 3 years ago
parent
commit
c0e044918c
  1. 8
      bot.py

8
bot.py

@ -35,7 +35,11 @@ async def on_ready():
async def on_message(message): async def on_message(message):
# Binflop # Binflop
if len(message.attachments) > 0: if len(message.attachments) > 0:
if message.author.id != 834065535041798225:
if message.author.bot:
return
perms = message.channel.permissions_for(message.guild.me)
if not perms.send_messages:
return
if not message.attachments[0].url.lower().endswith(('.html')): if not message.attachments[0].url.lower().endswith(('.html')):
file_type = mimetypes.guess_type(message.attachments[0].url) file_type = mimetypes.guess_type(message.attachments[0].url)
if not file_type[0] == None: if not file_type[0] == None:
@ -66,8 +70,6 @@ async def on_message(message):
except: except:
print("Permission error") print("Permission error")
logging.info(f'File uploaded by {message.author} ({message.author.id}): https://bin.birdflop.com/{key}') logging.info(f'File uploaded by {message.author} ({message.author.id}): https://bin.birdflop.com/{key}')
else:
logging.info(f'Blocked file upload by {message.author} ({message.author.id})')
# Pastebin is blocked in some countries # Pastebin is blocked in some countries
words = message.content.replace("\n", " ").split(" ") words = message.content.replace("\n", " ").split(" ")
for word in words: for word in words:

Loading…
Cancel
Save