-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.py
54 lines (42 loc) · 1.32 KB
/
bot.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
import os
from discord.ext import commands
import discord
import importlib
from utils import load_creds
# bot setup
os.chdir(os.path.dirname(__file__))
cred_path = "bot_creds.json"
creds = load_creds(cred_path)
token = creds["TOKEN"]
repo = creds["REPO"]
intentions = discord.Intents().all()
bot = commands.Bot(command_prefix="!", intents=intentions)
# load plugins
plugs = dict()
for plugin in os.scandir('plugins'):
if plugin.is_dir() and not plugin.name.startswith('__'):
print(f'importing: {plugin.name}')
plugs[plugin.name] = importlib.import_module(f'.{plugin.name}', 'plugins')
for k,v in plugs.items():
for name, data in v.__dict__.items():
if type(data) is commands.Command:
bot.add_command(data)
print(f'added: {data}')
@bot.event
async def on_ready():
print(f"{bot.user} has connected to Discord!")
@bot.command("liar")
async def say_liar(ctx):
"""
Call someone a liar!
"""
await ctx.send(
"What a fucking liar dude! What a fucking weaselly little liar dude! What a fucking weaselly little liar dude! Holy shit dude! Holy fucking shit dude! Literally lying. Still lying!"
)
@bot.command()
async def github(ctx):
"""
Displays the repo for this bot.
"""
await ctx.send(f'The repo for Jeeves is at:\n{repo}')
bot.run(token)