forked from viveksantayana/geas-bot
15 July Build
Implemented YAML Implemented basic client introspection for guild metadata Added todo tracker
This commit is contained in:
37
app/dev_cogs/commands/config.py
Normal file
37
app/dev_cogs/commands/config.py
Normal file
@ -0,0 +1,37 @@
|
||||
import os # OS Locations
|
||||
import yaml # YAML parser for Bot config files
|
||||
import json # Json Library to manage json Data files
|
||||
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
|
||||
|
||||
from dev import guild_ids
|
||||
|
||||
##### Configuration Cog
|
||||
class Configuration(commands.Cog):
|
||||
def __init__(self, client):
|
||||
self.client = client
|
||||
|
||||
@cog_ext.cog_slash(
|
||||
# base='botrole',
|
||||
# subcommand_group='configure',
|
||||
name='configure',
|
||||
description='Parameter to define the role assigned to the dice bots.',
|
||||
# base_description='Command to configure the various guild parameters.',
|
||||
# subcommand_group_description='These are configuration commands to set up the various guild parameters.',
|
||||
guild_ids=guild_ids
|
||||
# options=[
|
||||
# create_option(
|
||||
# name='botrole',
|
||||
# description='The role that the dice bots are assigned in order to access the text channels.'
|
||||
# type=8,
|
||||
# required=True
|
||||
# )
|
||||
# ]
|
||||
)
|
||||
async def _configure(self, ctx:SlashContext, option):
|
||||
await ctx.send(f'The `botrole` for the guild `{ctx.guild.name}` has been set to `{option}`.')
|
||||
|
||||
def setup(client):
|
||||
client.add_cog(Configuration(client))
|
51
app/dev_cogs/commands/debug.py
Normal file
51
app/dev_cogs/commands/debug.py
Normal file
@ -0,0 +1,51 @@
|
||||
import os
|
||||
from dotenv import load_dotenv # Import OS variables from Dotenv file.
|
||||
load_dotenv() # Load Dotenv. Delete this for production
|
||||
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
|
||||
|
||||
from dev import guild_ids, unloadAllCogs, loadAllCogs, reloadAllCogs
|
||||
|
||||
##### Debug Cog
|
||||
class Debug(commands.Cog):
|
||||
def __init__(self, client):
|
||||
self.client = client
|
||||
|
||||
@cog_ext.cog_slash(
|
||||
name='reload',
|
||||
description='Reloads all cogs',
|
||||
guild_ids=guild_ids
|
||||
)
|
||||
async def _reload(self, ctx:SlashContext):
|
||||
reloadAllCogs()
|
||||
await ctx.send('Reloading Cogs.')
|
||||
|
||||
@cog_ext.cog_slash(
|
||||
name='deleteAll',
|
||||
description='Deletes all Slash Commands',
|
||||
guild_ids=guild_ids
|
||||
)
|
||||
async def _deleteAll(self, ctx:SlashContext):
|
||||
await utils.manage_commands.remove_all_commands(
|
||||
bot_id=self.client.user.id,
|
||||
bot_token=os.getenv('TEST_3_TOKEN'),
|
||||
guild_ids=None
|
||||
)
|
||||
await utils.manage_commands.remove_all_commands(
|
||||
bot_id=self.client.user.id,
|
||||
bot_token=os.getenv('TEST_3_TOKEN'),
|
||||
guild_ids=guild_ids
|
||||
)
|
||||
await ctx.send('Deleted all commands.')
|
||||
|
||||
@commands.command(
|
||||
name='reloadAll'
|
||||
)
|
||||
async def _reloadAll(self, ctx):
|
||||
await ctx.send('Reloading all cogs.')
|
||||
reloadAllCogs()
|
||||
|
||||
def setup(client):
|
||||
client.add_cog(Debug(client))
|
Reference in New Issue
Block a user