SHARE
TWEET

nick of o-bot

Nick-of-Olas Dec 9th, 2019 98 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import discord
  2. import datetime
  3. import os
  4. import random
  5. from discord.ext import commands
  6. from discord.ext.commands import has_permissions, CheckFailure
  7.  
  8. client = commands.Bot(command_prefix = '.')
  9.  
  10. @client.command()
  11. @has_permissions(manage_messages=True)
  12. async def clear(ctx, amount=5):
  13.     if amount <= 50:
  14.         await ctx.channel.purge(limit=amount+1)
  15.         print(f'Deleted {amount} messages in {ctx.guild}\n---')
  16.     else:
  17.         await ctx.channel.purge(limit=21)
  18.         print(f'Deleted 20 (max number) messages in {ctx.guild}\n---')
  19.  
  20. @clear.error
  21. async def clear_error(ctx, error):
  22.     if isinstance(error, commands.CheckFailure):
  23.         print('A user unsuccessfully tried to clear messages')
  24.  
  25. @client.event
  26. async def on_ready():
  27.     print('{0.user} is now running!\n---'.format(client))
  28.  
  29. @client.event
  30. async def on_reaction_add(reaction, user):
  31.     if str(reaction.emoji) == "🆗":
  32.             await reaction.message.add_reaction('🇧')
  33.             await reaction.message.add_reaction('🇴')
  34.             await reaction.message.add_reaction('🅾')
  35.             await reaction.message.add_reaction('🇲')
  36.             await reaction.message.add_reaction('🇪')
  37.             await reaction.message.add_reaction('🇷')
  38.             async for user in reaction.users(limit=1):
  39.                 print('ADDITION: {0} OK Boomerified a message from {1.author} in {2}!'.format(user, reaction.message, reaction.message.guild))
  40.                 print('Timestamp: {:%Y-%m-%d %H:%M:%S}\n---'.format(datetime.datetime.now()))
  41.  
  42. @client.event
  43. async def on_reaction_remove(reaction, user):
  44.     if str(reaction.emoji) == "🆗":
  45.         await reaction.message.clear_reactions()
  46.         print('REMOVAL: {0} Un-OK Boomerified a message from {1.author} in {2}!'.format(user, reaction.message, reaction.message.guild))
  47.         print('Timestamp: {:%Y-%m-%d %H:%M:%S}\n---'.format(datetime.datetime.now()))
  48.  
  49. @client.event
  50. async def on_disconnect():
  51.     print('{0.user} has disconnected from Discord\n---'.format(client))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top