-
Notifications
You must be signed in to change notification settings - Fork 0
/
runmain.py
50 lines (39 loc) · 1.76 KB
/
runmain.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
# Filename: runmain.py
# ==== Externally Built Main Imports ====
import os
import discord
# ==== Externally Built Object Imports ====
from discord.ext import commands # For Slash Commands and Other Commands
from discord_slash import SlashCommand, SlashContext # For Slash Commands
from discord_slash.utils.manage_commands import create_choice, create_option # For Slash Commands options
from discord import Member
from random import randrange
from dotenv import load_dotenv
load_dotenv()
# ==== Locally Built Object Imports ====
from games import games
# ==== Set Up Discord Bot as Client ====
bot = commands.Bot(command_prefix='!', help_command=None) # For possible future command prefix use
bot.case_insensitive=True
slash = SlashCommand(bot, sync_commands=True) # Enables slash commands provided bot has permissions
# ==== Bot Connection On ====
@bot.event
async def on_ready():
print(f'{bot.user.name} has dropped into your Discord server!')
await bot.change_presence(activity=discord.Game(games[randrange(len(games))]),afk=False)
bot.load_extension('cogs.messages')
bot.run(os.getenv('DISCORD_TOKEN'))
# ***********************************************************************************
# ***** THIS WON'T WORK UNLESS A NEW BOT WITH A COMMAND SCOPE IS CREATED *****
# ***** TESTED AND IT WORKS ON A NEW BOT WITH THE PROPER SCOPE PERMISSIONS *****
# ***********************************************************************************
# ==================================================
# Slash Commands In Chat Tester
# ==================================================
# @slash.slash(
# name="Hello",
# description="Hello Slash Test",
# guild_ids=[930174863954554880]
# )
# async def hello(ctx:SlashContext):
# await ctx.send("World!")