Skip to content

Instantly share code, notes, and snippets.

@SamArroyos22
Created July 19, 2017 15:32
Show Gist options
  • Save SamArroyos22/ff61532b569ac6891d60e688d2d1fd85 to your computer and use it in GitHub Desktop.
Save SamArroyos22/ff61532b569ac6891d60e688d2d1fd85 to your computer and use it in GitHub Desktop.
Discord Bot Tutorial
import discord
import time
from discord.ext.commands import Bot
client = Bot("tb.")
@client.event
async def on_ready():
print("----------------------")
print("Logged In As")
print("Username: %s"%client.user.name)
print("ID: %s"%client.user.id)
print("----------------------")
@client.command()
async def ping():
'''See if The Bot is Working'''
pingtime = time.time()
pingms = await client.say("Pinging...")
ping = time.time() - pingtime
await client.edit_message(pingms, "Pong! The ping time is `%.01f seconds`" % ping)
client.run("Your_bot_token_here")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment