15 July Nightly Commit

Split cogs into different files
About to change file structuring to move dev file to main file
This commit is contained in:
2021-07-15 22:54:09 +01:00
parent ef6c49b5f8
commit b0b417a8d2
20 changed files with 507 additions and 217 deletions

View File

@ -0,0 +1,26 @@
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 dev import configFile, yaml_load, yaml_dump
### Cog for handling the non-Slash prefix for native Bot commands.
class Prefix(commands.Cog):
def __init__(self, client):
self.client = client
@commands.command(
name = 'changeprefix',
aliases = ['prefix'],
description = 'This command changes the prefix string for the native, non-slash command functionality of the bot. Defaults to `-`. It does not affect the workings of /commands.',
brief = 'Changes the bot prefix.'
)
async def _changePrefix(self, ctx, prefix:str = '-'):
conf = yaml_load(configFile)
conf[str(ctx.guild.id)]['prefix'] = prefix.lower()
yaml_dump(conf, configFile)
await ctx.send(f"`{self.client.user.name}`'s prefix for native bot commands has been changed to `{prefix}` for the guild `{ctx.guild.name}`.\n`Note: This will not affect /commands.`")
def setup(client):
client.add_cog(Prefix(client))