forked from eagleblitz/DiscordPythonBots
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTutorial 2.py
More file actions
32 lines (23 loc) · 818 Bytes
/
Tutorial 2.py
File metadata and controls
32 lines (23 loc) · 818 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import discord
from discord.ext.commands import Bot
from discord.ext import commands
import asyncio
import time
Client = discord.Client()
client = commands.Bot(command_prefix = "!")
@client.event
async def on_ready():
print("Bot is online and connected to Discord")
@client.event
async def on_message(message):
if message.content.upper().startswith('!PING'):
userID = message.author.id
await client.send_message(message.channel, "<@%s> Pong!" % (userID))
if message.content.upper().startswith('!SAY'):
args = message.content.split(" ")
#args[0] = !SAY
#args[1] = Hey
#args[2] = There
#args[1:] = Hey There
await client.send_message(message.channel, "%s" % (" ".join(args[1:])))
client.run("<token>") #Insert your bots token here