forked from eagleblitz/DiscordPythonBots
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTutorial 3.py
More file actions
36 lines (27 loc) · 1.28 KB
/
Tutorial 3.py
File metadata and controls
36 lines (27 loc) · 1.28 KB
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
33
34
35
36
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'):
if message.author.id == "<user id>": #Replace <User ID> with the ID of the user you want to be able to execute this command!
args = message.content.split(" ")
await client.send_message(message.channel, "%s" % (" ".join(args[1:])))
else:
await client.send_message(message.channel, "You do not have permission")
if message.content.upper().startswith('!AMIADMIN'):
if "<role id>" in [role.id for role in message.author.roles]: #Replace <Role ID> with the ID of the role you want to be able to execute this command
await client.send_message(message.channel, "You are an admin")
else:
await client.send_message(message.channel, "You are not an admin")
client.run("<token>")