Guest User

Untitled

a guest
Oct 18th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. import discord
  2. from discord.ext.commands import Bot
  3. from discord.ext import commands
  4. import asyncio
  5.  
  6.  
  7. TOKEN = "NTAwNTIyMTA3OTIzMzMzMTI4.DqiyBA.xmnaSVDpqtqAMNqhc9SyrjQNpag"
  8. Client = discord.Client()
  9. client = commands.Bot(command_prefix = '.')
  10.  
  11. @client.event
  12. async def on_ready():
  13. print("Bot's online")
  14. await client.change_presence(game=discord.Game(name=' '+str(len(client.servers))+' servers and'' '+str(len(set(client.get_all_members())))+' users! ', type=3))
  15.  
  16. @client.command(pass_context=True)
  17. async def ping(ctx):
  18. resp = await client.say(' '+ctx.message.author.mention+' Pong! Pinging...')
  19. diff = resp.timestamp - ctx.message.timestamp
  20. resp2 = (" "+ctx.message.author.mention+f" Pong! `{1000*diff.total_seconds():.1f}ms`")
  21. await client.edit_message(resp, resp2)
  22.  
  23. @client.command(pass_context=True)
  24. async def say(ctx, *, output: str):
  25. await client.say(output)
  26.  
  27. @client.command(pass_context = True)
  28. @commands.has_permissions(kick_members=True)
  29. async def warn(ctx, userame: discord.User, * message:str):
  30.  
  31. sender = ctx.message.author.name
  32. sname = ctx.message.server.name
  33. senname = ctx.message.author.display_name
  34. oup = ' '.join(word for word in message [0:])
  35. userName = userame.mention
  36.  
  37. await client.say(" {0} has been warned for **{1} ** by {2} .".format(userName, oup, sender))
  38. await client.send_message(userame, "You have recived a warning for: **{0}** by {1} in {2}. ".format(oup,senname,sname))
  39.  
  40.  
  41.  
  42. @client.command(pass_context=True)
  43. async def clear(ctx, amnt=20):
  44. channel = ctx.message.channel
  45. messages =[ ]
  46. async for message in client.logs_from(channel, limit=int(amnt)):
  47. messages.append(message)
  48. await client.delete_messages(messages)
  49. await client.say("Messages Deleted")
  50.  
  51.  
  52. client.run(TOKEN)
Add Comment
Please, Sign In to add comment