forked from viveksantayana/geas-bot
Started writing /commands.
Completed channel group of config subcommands Fixed bugs in config initialisation function
This commit is contained in:
@ -9,7 +9,14 @@ from bot import configFile, yaml_load, yaml_dump
|
||||
class Prefix(commands.Cog, name='Server Command Prefix'):
|
||||
def __init__(self, client):
|
||||
self.client = client
|
||||
|
||||
|
||||
#### Check if user is an administrator
|
||||
async def cog_check(self, ctx):
|
||||
for role in ctx.author.roles:
|
||||
if role.permissions.administrator:
|
||||
return True
|
||||
return ctx.author.guild_permissions.administrator
|
||||
|
||||
@commands.command(
|
||||
name = 'changeprefix',
|
||||
aliases = ['prefix'],
|
||||
@ -20,7 +27,7 @@ class Prefix(commands.Cog, name='Server Command Prefix'):
|
||||
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.`")
|
||||
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\nNote: This will not affect /commands.```")
|
||||
|
||||
def setup(client):
|
||||
client.add_cog(Prefix(client))
|
Reference in New Issue
Block a user