Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import discord
- from discord.ext.commands import Bot
- from discord.ext import commands
- import asyncio
- TOKEN = "NTAwNTIyMTA3OTIzMzMzMTI4.DqiyBA.xmnaSVDpqtqAMNqhc9SyrjQNpag"
- Client = discord.Client()
- client = commands.Bot(command_prefix = '.')
- @client.event
- async def on_ready():
- print("Bot's online")
- await client.change_presence(game=discord.Game(name=' '+str(len(client.servers))+' servers and'' '+str(len(set(client.get_all_members())))+' users! ', type=3))
- @client.command(pass_context=True)
- async def ping(ctx):
- resp = await client.say(' '+ctx.message.author.mention+' Pong! Pinging...')
- diff = resp.timestamp - ctx.message.timestamp
- resp2 = (" "+ctx.message.author.mention+f" Pong! `{1000*diff.total_seconds():.1f}ms`")
- await client.edit_message(resp, resp2)
- @client.command(pass_context=True)
- async def say(ctx, *, output: str):
- await client.say(output)
- @client.command(pass_context = True)
- @commands.has_permissions(kick_members=True)
- async def warn(ctx, userame: discord.User, * message:str):
- sender = ctx.message.author.name
- sname = ctx.message.server.name
- senname = ctx.message.author.display_name
- oup = ' '.join(word for word in message [0:])
- userName = userame.mention
- await client.say(" {0} has been warned for **{1} ** by {2} .".format(userName, oup, sender))
- await client.send_message(userame, "You have recived a warning for: **{0}** by {1} in {2}. ".format(oup,senname,sname))
- @client.command(pass_context=True)
- async def clear(ctx, amnt=20):
- channel = ctx.message.channel
- messages =[ ]
- async for message in client.logs_from(channel, limit=int(amnt)):
- messages.append(message)
- await client.delete_messages(messages)
- await client.say("Messages Deleted")
- client.run(TOKEN)
Add Comment
Please, Sign In to add comment