-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
executable file
·46 lines (29 loc) · 799 Bytes
/
Copy pathmain.py
File metadata and controls
executable file
·46 lines (29 loc) · 799 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import discord
from discord.ext import commands
import json
with open("secrets.json", "r") as f:
secrets = json.load(f)
# the bot!
bot = commands.Bot(
command_prefix="_"
)
@bot.event
async def on_ready():
bot.load_extension("main_cog")
@bot.command()
async def hello_name(context, name):
await context.send(f"Hello, {name}!")
@bot.command()
async def test(context, name, clss):
await context.send(f"Hello, {name} from {clss}!")
@bot.command()
async def multiarg(context, *, name):
await context.send(f"Hello, {name}!")
@hello_name.error
async def anything(context, error):
await context.send("Please enter a name!")
@bot.event
async def on_command_error(context, error):
await context.send(error)
# run bot using bot token!
bot.run(secrets["TOKEN"])