コード例 #1
0
def main():
    cli_args = parse_args.parse_args(os.path.basename(__file__), 4)

    # initialize logger
    if cli_args.verbose:
        logger.setLevel(logging.DEBUG)

    check_requirements.check_requirements(skip=cli_args.skip_requirements)

    run(cli_args)
コード例 #2
0
ファイル: invitation.py プロジェクト: wblazej/AlwaysPresent
    async def _invite(self, ctx, *args):
        args = parse_args(args)

        if args.get("help") or args.get("h"):
            await command_help(ctx, invitation)
            return None

        embed = discord.Embed()
        embed.title = Config.TRANSLATION_INVITATION
        embed.description = Config.INVITATION
        embed.color = Config.MAIN_COLOR
        embed.set_thumbnail(url=Config.INVITATION_ICON)
        await ctx.send(embed=embed)
コード例 #3
0
ファイル: permissions.py プロジェクト: wblazej/AlwaysPresent
    async def _permissions(self, ctx, *args):
        args = parse_args(args)

        if args.get("help") or args.get("h"):
            await command_help(ctx, permissions)
            return

        embed = discord.Embed()
        embed.color = Config.MAIN_COLOR
        embed.title = Config.TRANSLATION_PERMISSIONS
        embed.set_thumbnail(url=Config.PERMISSIONS_ICON)

        content = f"{Config.TRANSLATION_PERMISSIONS_CODE}: {Config.PERMISSIONS_CODE}\n\n"

        for permission in Config.PERMISSIONS_LIST:
            content += f":white_check_mark: {permission}\n"

        embed.description = content
        await ctx.send(embed=embed)
コード例 #4
0
ファイル: _bot.py プロジェクト: wblazej/AlwaysPresent
    async def _bot_(self, ctx, *args):
        args = parse_args(args)

        if args.get("help") or args.get("h"):
            await command_help(ctx, _bot)
            return None

        embed = discord.Embed()
        embed.title = Config.TRANSLATION_BOT_INFO
        embed.description = Config.BOT_DESCRIPTION
        embed.color = Config.MAIN_COLOR
        embed.set_thumbnail(url=Config.BOT_ICON)

        embed.add_field(name=Config.TRNASLATION_VERSION, value=Config.VERSION, inline=True)
        embed.add_field(name=Config.TRANSLATION_LANGUAGE, value=Config.LANGUAGE, inline=True)
        embed.add_field(name=Config.TRANSLATION_LIBRARY, value=Config.LIBRARY, inline=True)
        embed.add_field(name=Config.TRANSLATION_RUNNING_ON, value=Config.RUNNING_ON, inline=True)
        embed.add_field(name=Config.TRANSLATION_AUTHOR, value=Config.AUTHOR, inline=True)
        embed.add_field(name=Config.TRANSLATION_ICONS, value=Config.ICONS_AUTHOR, inline=True)
        embed.add_field(name=Config.TRANSLATION_REPOSITORY, value=Config.REPO, inline=True)

        await ctx.send(embed=embed)
コード例 #5
0
    async def _lesson(self, ctx, *args):
        args = parse_args(args)

        if args.get("help") or args.get("h"):
            await command_help(ctx, lesson)
            return

        time = None
        if args.get("time"):
            time = args['time']['value']
        elif args.get("t"):
            time = args['t']['value']

        if time:
            try:
                time = int(time)
            except ValueError:
                await send_error(ctx, Config.TIME_INTEGER_REQIURED)
                return

        practice = False
        if args.get("practice") or args.get("p"):
            practice = True

        no_mention = False
        if args.get("nomention") or args.get("n"):
            no_mention = True

        await ctx.message.delete()

        new_lesson = Lesson(bot=self.bot,
                            teacher=ctx.author.id,
                            channel=ctx.channel.id,
                            guild=ctx.guild.id,
                            time=time,
                            practice=practice,
                            no_mention=no_mention)

        lessons[await new_lesson.begin_lesson()] = new_lesson
コード例 #6
0
ファイル: help.py プロジェクト: wblazej/AlwaysPresent
    async def _help(self, ctx, *args):
        args = parse_args(args)

        if args.get("help") or args.get("h"):
            await command_help(ctx, help)
            return None
        
        content = ""
        for file in listdir("cmds"):
            if file.split('.')[-1] == "py":
                name = file.replace('.py', '')
                command_file = importlib.import_module(f'cmds.{name}')
                command = getattr(command_file, name)

                content += f"» **{Config.PREFIX}{command.command}** - {command.description}\n"

        content += f"\n{Config.HELP_INFO}"

        embed = discord.Embed()
        embed.color = Config.MAIN_COLOR
        embed.title = "**POMOC**"
        embed.description = content
        embed.set_thumbnail(url=Config.HELP_ICON)
        await ctx.send(embed=embed)