30 lines
1.0 KiB
Python
30 lines
1.0 KiB
Python
|
import yaml # YAML parser for Bot config files
|
||
|
import asyncio # Discord Py Dependency
|
||
|
import discord # Main Lib
|
||
|
from discord.ext import commands # Commands module
|
||
|
from discord_slash import SlashCommand, SlashContext, cog_ext, utils # Slash Command Library
|
||
|
from discord_slash.utils.manage_commands import create_choice, create_option # Slash Command features
|
||
|
import logging
|
||
|
# logger and handler
|
||
|
from dev import configFile, yaml_load, yaml_dump
|
||
|
|
||
|
#### Actions for the Bot to take on connecting to Discord.
|
||
|
class on_connect(commands.Cog):
|
||
|
def __init__(self, client):
|
||
|
self.client = client
|
||
|
|
||
|
@commands.Cog.listener()
|
||
|
async def on_connect(self): ## Actions for when bot logs in and enters ready state
|
||
|
print('Bot has connected.')
|
||
|
# logging.info('Bot has connected.')
|
||
|
await self.client.change_presence(
|
||
|
status = discord.Status.online,
|
||
|
activity = discord.Activity(
|
||
|
type = discord.ActivityType.listening,
|
||
|
name = f'/commands'
|
||
|
)
|
||
|
)
|
||
|
# for g in self.client.guilds:
|
||
|
|
||
|
def setup(client):
|
||
|
client.add_cog(on_connect(client))
|