-
Notifications
You must be signed in to change notification settings - Fork 1
/
Discord_Bot_Simple.py
66 lines (55 loc) · 1.62 KB
/
Discord_Bot_Simple.py
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import nextcord
import random
import asyncio
from nextcord.ext import commands
description = "Basic example bot"
intents = nextcord.Intents.default()
intents.members = True
intents.message_content = True
bot = commands.Bot(command_prefix="!", description=description, intents=intents)
@bot.event
async def on_message(message):
if("😎" in message.content):
await message.add_reaction("😎")
await bot.process_commands(message)
#WHEN READY
@bot.event
async def on_ready():
await bot.change_presence(activity=nextcord.Game(name = "My First Bot!"))
print("Successfully set Bot's game status")
@bot.command(help="pong!")
async def ping(ctx):
await ctx.send("pong")
@bot.command(help="ask the 8ball a question")
async def eightball(ctx):
RESPONSES = [
"Yes",
"No",
"Maybe",
"That's up to you",
"Ask again later",
#Add more here!
]
msg = random.choice(RESPONSES)
await ctx.send(msg)
@bot.command(help="see who is online!")
async def scan(ctx):
msg = "The list of all online members are:\n```"
for member in ctx.guild.members:
if(member.status == nextcord.Status.online):
msg += str(member)+"\n"
msg += "```"
await ctx.send(msg)
# @bot.command()
# async def help(message):
# await message.channel.send("""I have the following commands:```
# /help - shows this message
# /ping - pong!
# /8ball - ask the 8Ball a question
# /scan - see who is online!
# ```""")
print("Starting Bot")
file = open("../test/bot_token.txt",'r')#change this to the path of your token
TOKEN = file.read()
#print(TOKEN)
bot.run(TOKEN)