Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions APIs/Discord API/discord_bot_example.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# make sure you have python 3.5.4 or higher
# By @ofirisakov
try:
import discord
from discord.ext import commands
import discord
from discord.ext import commands
except ImportError:
print('Please pip install discord')
print('Please pip install discord')


PREFIX = '!'
Expand All @@ -14,25 +14,25 @@

@bot.event
async def on_ready():
"""
Prints on_ready.
"""
Prints on_ready.

Args:
"""
print('Logged in!')
print(f'Name: {bot.user.name}')
print(f'ID: {bot.user.id}')
Args:
"""
print('Logged in!')
print(f'Name: {bot.user.name}')
print(f'ID: {bot.user.id}')


@bot.command()
async def ping(ctx):
"""
Send ping message.
"""
Send ping message.

Args:
ctx: (todo): write your description
"""
await ctx.send(f'pong! `{int(bot.latency * 1000)}ms`')
Args:
ctx: (todo): write your description
"""
await ctx.send(f'pong! `{int(bot.latency * 1000)}ms`')


bot.run(TOKEN)