예제 #1
0
async def kampung(ctx: Context, action):
    async with ctx.typing():
        if action == 'start':
            requests.post(
                'https://api.idcloudhost.com/v1/jkt01/user-resource/vm/start',
                headers={'apikey': getenv('ID_CLOUD_API_KEY')},
                data={'uuid': '4fe69833-9463-48f9-97b4-a194c5cb504e'})
            return await ctx.send(
                embed=UI.success_embed("Server Berhasil Nyala"))

        if action == 'stop':
            requests.post(
                'https://api.idcloudhost.com/v1/jkt01/user-resource/vm/stop',
                headers={'apikey': getenv('ID_CLOUD_API_KEY')},
                data={'uuid': '4fe69833-9463-48f9-97b4-a194c5cb504e'})
            return await ctx.send(
                embed=UI.success_embed("Server Berhasil Mati"))

        if action == 'info':
            resp = requests.get(
                'https://api.idcloudhost.com/v1/jkt01/user-resource/vm',
                headers={'apikey': getenv('ID_CLOUD_API_KEY')},
                data={'uuid': '4fe69833-9463-48f9-97b4-a194c5cb504e'})
            return await ctx.send(
                embed=UI.success_embed(f"Server is {resp.json()['status']}"))
예제 #2
0
    async def unload(self, ctx, extension):
        if extension == 'setting':
            return await ctx.send(
                embed=UI.error_embed("Dilarang unload setting 😠"))

        self.bot.unload_extension(f'cogs.{extension}')
        await ctx.message.add_reaction('👍')
예제 #3
0
    async def on_command_error(self, ctx, error):
        error = error.original if hasattr(error, 'original') else error
        if hasattr(ctx.command, 'on_error'):
            return

        if debug:
            await ctx.send(embed=UI.error_embed(error))

        raise error
예제 #4
0
    async def kokuhaku(self, ctx, *, kokuhaku: str):
        channel = get_anonymous_channel(self.bot)

        async with ctx.typing():
            koku_embed = Embed(color=randint(0, 0xffffff))
            koku_embed.add_field(name='Kokuhaku', value=kokuhaku)
            await channel.send(embed=koku_embed)
            await ctx.send(embed=UI.success_embed(
                'Kokuhaku kamu sudah dikirim secara anonymous'))
예제 #5
0
async def unloadall(ctx: Context):
    async with ctx.typing():
        for filename in listdir('./cogs'):
            if filename.endswith('.py'):
                try:
                    ctx.bot.unload_extension(f'cogs.{filename[:-3]}')
                except:
                    pass

    await ctx.send(embed=UI.success_embed("Semua cogs sudah berhasil dilepas"))
예제 #6
0
 async def remove(self, ctx, id: int):
     async with ctx.typing():
         self.rm.remove(id)
         return await ctx.send(
             embed=UI.success_embed("Pesan sudah berhasil dihapus"))
예제 #7
0
 async def add(self, ctx, *, message: str):
     async with ctx.typing():
         self.rm.add(message.title())
         return await ctx.send(
             embed=UI.success_embed("Pesan sudah berhasil ditambahkan"))