示例#1
0
    async def shell(self, ctx, *arg):
        try:
            cmd = " ".join(arg[:])
            res = subprocess.check_output(cmd, shell=True, encoding='utf-8')
            embed = discord.Embed(title=get_lan(ctx.author.id, 'owners_shell'),
                                  description=get_lan(
                                      ctx.author.id,
                                      'owners_shell_description'),
                                  color=self.color)
            embed.add_field(name="Input", value=f'```{cmd}```', inline=False)
            embed.add_field(name="Output", value=f"```{res}```", inline=False)
            footer(embed)
            await ctx.send(embed=embed)

        except (discord.errors.HTTPException):
            cmd = " ".join(arg[:])
            res = subprocess.check_output(cmd, shell=True, encoding='utf-8')
            await ctx.send(f"```{res}```")

        except (subprocess.CalledProcessError):
            embed = discord.Embed(title=get_lan(ctx.author.id,
                                                'owners_shell_error'),
                                  description=get_lan(
                                      ctx.author.id,
                                      'owners_shell_error_description'),
                                  color=self.color)
            footer(embed)
            await ctx.send(embed=embed)
示例#2
0
    async def broadcast(self, ctx, *, arg):
        embed = discord.Embed(title=get_lan(ctx.author.id, 'owners_broadcast'),
                              description=str(arg),
                              color=color_code)
        embed.set_footer(text=BOT_NAME_TAG_VER)
        for i in self.bot.guilds:
            ch = self.bot.get_guild(int(i.id)).channels
            for a in ch:
                try:
                    target_channel = self.bot.get_channel(a.id)
                    await target_channel.send(embed=embed)

                except Exception:
                    pass
                else:
                    LOGGER.info(f"{a} ({a.id}) 서버에 공지 전송 완료!")
                    break
        embed = discord.Embed(
            title=get_lan(ctx.author.id, 'owners_broadcast_finish'),
            description=get_lan(
                ctx.author.id,
                'owners_broadcast_info').format(broadcast_info=arg),
            color=color_code)
        footer(embed)
        return await ctx.send(embed=embed)
示例#3
0
 async def unload(self, ctx, module):
     try:
         self.bot.unload_extension("musicbot.cogs." + module)
         LOGGER.info(f"언로드 성공!\n모듈 : {module}")
         embed = discord.Embed(title='언로드 성공!',
                               description=f'모듈 : {module}',
                               color=self.color)
         if module in EXTENSIONS:
             EXTENSIONS[EXTENSIONS.index(module)] = f"*~~{module}~~*"
     except Exception as error:
         LOGGER.error(f"언로드 실패!\n에러 : {error}")
         embed = discord.Embed(title='언로드 실패!',
                               description=f'에러 : {error}',
                               color=self.error_color)
     footer(embed)
     await ctx.send(embed=embed)
示例#4
0
 async def broadcast(self, ctx, *, arg):
     embed = discord.Embed(title="공지", description=str(arg), color=color_code)
     embed.set_footer(text=BOT_NAME_TAG_VER)
     for i in self.bot.guilds:
         ch = self.bot.get_guild(int(i.id)).channels
         for a in ch:
             try:
                 target_channel = self.bot.get_channel(a.id)
                 await target_channel.send(embed=embed)
             
             except:
                 pass
             else:
                 LOGGER.info(f"{a} ({a.id}) 서버에 공지 전송 완료!")
                 break
     embed = discord.Embed(title="공지발송 완료!", description=f"공지 내용 :\n```{str(arg)}```", color=color_code)
     footer(embed)
     return await ctx.send(embed=embed)
示例#5
0
    async def shell(self, ctx, *arg) :
        try :
            cmd = " ".join(arg[:])
            res = subprocess.check_output(cmd, shell=True, encoding='utf-8')
            embed=discord.Embed(title="**명령어 전달 성공!**", description = "명령어를 성공적으로 서버로 전달했어요.", color=self.color)
            embed.add_field (name ="Input", value = f'```{cmd}```', inline=False)
            embed.add_field(name="Output", value=f"```{res}```", inline=False)
            footer(embed)
            await ctx.send(embed=embed)

        except (discord.errors.HTTPException) :
            cmd = " ".join(arg[:])
            res = subprocess.check_output(cmd, shell=True, encoding='utf-8')
            await ctx.send(f"```{res}```")
         
        except (subprocess.CalledProcessError) :
            embed=discord.Embed(title="**커맨드 오류!**", description="커맨드 명령어 처리 도중 에러가 발생했어요.", color=self.color)
            footer(embed)
            await ctx.send(embed=embed)
示例#6
0
 async def unload(self, ctx, module):
     try:
         self.bot.unload_extension("musicbot.cogs." + module)
         LOGGER.info(f"언로드 성공!\n모듈 : {module}")
         embed = discord.Embed(
             title=get_lan(ctx.author.id, "owners_unload_success"),
             description=get_lan(ctx.author.id,
                                 "owners_module").format(module=module),
             color=self.color)
         if module in EXTENSIONS:
             EXTENSIONS[EXTENSIONS.index(module)] = f"*~~{module}~~*"
     except Exception as error:
         LOGGER.error(f"언로드 실패!\n에러 : {error}")
         embed = discord.Embed(title=get_lan(ctx.author.id,
                                             "owners_unload_fail"),
                               description=f'에러 : {error}',
                               color=self.error_color)
     footer(embed)
     await ctx.send(embed=embed)