Browse Source

misc renamed to utils and set command group made. Admin being renamed to settings as its all settings for the bot. New Admin cog will be just admin commands

tags/v0.4.0
roxie 6 years ago
parent
commit
bbcdc8fa0f
2 changed files with 16 additions and 20 deletions
  1. +15
    -19
      cogs/Admin.py
  2. +1
    -1
      cogs/__init__.py

+ 15
- 19
cogs/Admin.py View File



import discord import discord
from discord.ext.commands import bot from discord.ext.commands import bot
from discord.ext.commands import group




def owner(ctx): def owner(ctx):
return owner_id == ctx.message.author.id return owner_id == ctx.message.author.id




class Admin():
class Settings():
def __init__(self, Bot): def __init__(self, Bot):
self.bot = Bot self.bot = Bot
self.con = Config(Bot) self.con = Config(Bot)
config = config[setting] config = config[setting]
return await self.bot.say(str(json.dumps(config, indent=4))) return await self.bot.say(str(json.dumps(config, indent=4)))


# TODO: Combine all set commands into one
@bot.group(pass_context=True)
async def test(self, ctx):
if True:
return self.bot.say("True")
@group(pass_context=True, hidden=True)
async def set(self, ctx):
if ctx.invoked_subcommand is None:
return await self.bot.say('Missing Argument')


@test.command()
async def hallo(self, ctx):
await self.bot.say('Pushing to {}'.format(ctx))

@bot.command(pass_context=True, hidden=True)
async def set_welcomechannel(self, ctx, channel: discord.Channel = None):
@set.command(pass_context=True, hidden=True)
async def welcomechannel(self, ctx, channel: discord.Channel = None):
if not owner(ctx): if not owner(ctx):
return await self.bot.reply(self.con.no_perms_reponse, delete_after=self.con.delete_after) return await self.bot.reply(self.con.no_perms_reponse, delete_after=self.con.delete_after)
else: else:
self.con.updateconfig(self.serverconfig) self.con.updateconfig(self.serverconfig)
return await self.bot.say("{} has been set as the welcome channel!".format(channel.mention)) return await self.bot.say("{} has been set as the welcome channel!".format(channel.mention))


@bot.command(pass_context=True, hidden=True)
async def set_goodbyechannel(self, ctx, channel: discord.Channel = None):
@set.command(pass_context=True, hidden=True)
async def goodbyechannel(self, ctx, channel: discord.Channel = None):
if not owner(ctx): if not owner(ctx):
return await self.bot.reply(self.con.no_perms_reponse, delete_after=self.con.delete_after) return await self.bot.reply(self.con.no_perms_reponse, delete_after=self.con.delete_after)
else: else:
self.con.updateconfig(self.serverconfig) self.con.updateconfig(self.serverconfig)
return await self.bot.say("{} has been set as the goodbye channel!".format(channel.mention)) return await self.bot.say("{} has been set as the goodbye channel!".format(channel.mention))


@bot.command(pass_context=True, hidden=True)
async def set_twitchchannel(self, ctx, channel: discord.Channel = None):
@set.command(pass_context=True, hidden=True)
async def twitchchannel(self, ctx, channel: discord.Channel = None):
if not owner(ctx): if not owner(ctx):
return await self.bot.reply(self.con.no_perms_reponse, delete_after=self.con.delete_after) return await self.bot.reply(self.con.no_perms_reponse, delete_after=self.con.delete_after)
else: else:
self.con.updateconfig(self.serverconfig) self.con.updateconfig(self.serverconfig)
return await self.bot.say("{} has been set as the twitch shilling channel!".format(channel.mention)) return await self.bot.say("{} has been set as the twitch shilling channel!".format(channel.mention))


@bot.command(pass_context=True, hidden=True)
async def set_customwelcomemessage(self, ctx, *, message: str):
@set.command(pass_context=True, hidden=True)
async def mwelcomemessage(self, ctx, *, message: str):
if not owner(ctx): if not owner(ctx):
return await self.bot.reply(self.con.no_perms_reponse, delete_after=self.con.delete_after) return await self.bot.reply(self.con.no_perms_reponse, delete_after=self.con.delete_after)
else: else:




def setup(Bot): def setup(Bot):
Bot.add_cog(Admin(Bot))
Bot.add_cog(Settings(Bot))

+ 1
- 1
cogs/__init__.py View File

'cogs.selfAssign', 'cogs.selfAssign',
'cogs.Fun', 'cogs.Fun',
'cogs.joinLeave', 'cogs.joinLeave',
'cogs.Misc',
'cogs.Utils',
'config.config' 'config.config'
] ]

Loading…
Cancel
Save