Пример #1
0
 async def autojindanset(self, ctx, name: str, birthday: str, area: str,
                         pos: str, schoolname: str, password: str):
     user_id = str(ctx.author.id)
     user_name = str(ctx.author)
     hcskr_result = await hcskr.asyncGenerateToken(name, birthday, area,
                                                   schoolname, pos,
                                                   password)
     if hcskr_result['error']:
         LOGGER.info(
             f"{ctx.author} 자가진단 설정에 실패하였습니다. {hcskr_result['message']}")
         embed = discord.embeds.Embed(
             title=f"자가진단 등록 오류",
             description=f"```{hcskr_result['message']}```")
         embed.set_footer(text="audiscordbot.xyz")
         return await ctx.reply(embed=embed)
     token = hcskr_result['token']
     await db.autojindanDB.insert_one({
         "user_name": user_name,
         "user_id": user_id,
         "token": token,
         "name": name
     })
     embed = discord.embeds.Embed(
         title=f"자가진단 등록 성공",
         description=
         f"매일 아침 7시경에 자동으로 자가 진단이 수행됩니다!\n자가진단 기록은 [여기](http://discord.gg/cs3EGVf3Qd)에서 확인가능합니다\n자동으로 [개인정보처리방침](http://audiscordbot.xyz/privacy)에 동의 하게됩니다",
         author=ctx.author)
     embed.set_footer(text="audiscordbot.xyz")
     await ctx.reply(embed=embed)
     LOGGER.info(f"{ctx.author}자가진단 정보를 성공적으로 등록하였습니다!.")
Пример #2
0
async def on_ready():
    LOGGER.info("자가진단 실행...")
    count_all = 0
    count_success = 0
    count_fail = 0
    cursor = db.autojindanDB.find({})
    for document in await cursor.to_list(length=5000):
        count_all += 1
        try:
            hcsdata = await hcskr.asyncTokenSelfCheck(document.get("token"))
            if hcsdata.get("error"):
                count_fail += 1
                LOGGER.error(
                    f"{document.get('user_name')}({document.get('user_id')}): 자가진단 수행실패, {hcsdata}"
                )  # 로깅
            else:
                count_success += 1
                LOGGER.info(
                    f"{document.get('user_name')}({document.get('user_id')}): 자가진단 수행 성공!, {hcsdata}"
                )  # 로깅
        except Exception as e:
            LOGGER.exception(f"자가진단 수행중 에러발생!: {e}\n")  # 로깅
            print(document)
            count_fail += 1
            continue
    LOGGER.warning(
        f"\n---------------{datetime.datetime.now()}---------------\n오늘의 자가진단 결과:\n전체 이용자 수: {count_all}\n성공: {count_success}\n실패: {count_fail}\n---------------------------------------------"
    )  # 로깅
    await client.get_channel(int(828551043272278056)).send(
        f"```전체 이용자 수: {count_all}\n성공: {count_success}\n실패: {count_fail}```")
    await asyncio.sleep(10)
    quit()
Пример #3
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)
Пример #4
0
 async def on_ready(self):
     LOGGER.info(BOT_NAME_TAG_VER)
     await self.change_presence(
         activity=discord.Game(f"{commandInt}help : 도움말"),
         status=discord.Status.online,
         afk=False)
     bot.loop.create_task(status_task())
Пример #5
0
 async def autojindandel(self, ctx, name: str = None):
     user_id = str(ctx.author.id)
     if name is None:
         try:
             user_list = []
             cursor2 = db.autojindanDB.find({"user_id": user_id})
             for document in await cursor2.to_list(length=100):
                 user_list.append("`" + document['name'] + "`")
             embed = discord.embeds.Embed(title=f"자동 자가진단",
                                          description=f"자동 자가진단 정보 삭제",
                                          author=ctx.author)
             embed.add_field(name="등록된 유저목록",
                             value=f"{user_list}",
                             inline=False)
             embed.add_field(name="자가진단 삭제 방법",
                             value=f"`!자가진단삭제` [유저실명]",
                             inline=False)
             embed.set_footer(text="audiscordbot.xyz")
             await ctx.send(embed=embed)
         except:
             embed = discord.embeds.Embed(title=f"자동 자가진단",
                                          description=f"자동 자가진단 정보 삭제",
                                          author=ctx.author)
             embed.add_field(
                 name="등록된 유저목록",
                 value=
                 f"등록된 정보가 없거나, 2021년 06월 16일 이전등록 유저입니다 \n 이전등록 유저일경우 [이곳](https://discord.gg/cs3EGVf3Qd) 에서 관리자에게 DM으로 처리가 가능합니다",
                 inline=False)
             embed.add_field(name="자가진단 삭제 방법",
                             value=f"`!자가진단삭제` [유저실명]",
                             inline=False)
             embed.set_footer(text="audiscordbot.xyz")
             await ctx.send(embed=embed)
     else:
         result = await db.autojindanDB.find_one_and_delete({
             "user_id": user_id,
             "name": name
         })
         embed = discord.embeds.Embed(title=f"자동 자가진단",
                                      description=f"자동 자가진단 정보 삭제",
                                      author=ctx.author)
         if result == None:
             embed.add_field(name="삭제실패",
                             value=f"`{name}` 님의 자가진단 정보가 없습니다",
                             inline=False)
             embed.set_footer(text="audiscordbot.xyz")
             await ctx.send(embed=embed)
         else:
             embed.add_field(name="삭제성공",
                             value=f"`{name}` 님의 자가진단 정보가 삭제되었습니다",
                             inline=False)
             embed.set_footer(text="audiscordbot.xyz")
             await ctx.send(embed=embed)
             LOGGER.info(f"{ctx.author}자가진단 정보를 성공적으로 삭제했습니다!.")
Пример #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='언로드 성공!',
                               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)
Пример #7
0
    def __init__(self):
        super().__init__(command_prefix=commandInt, intents=intents)
        self.remove_command("help")

        # Lavalink Download

        LOGGER.info("Lavalink Downloading...")
        request.urlretrieve(
            "https://github.com/Cog-Creators/Lavalink-Jars/releases/latest/download/Lavalink.jar",
            "Lavalink.jar")

        process = multiprocessing.Process(target=child_process)
        process.start()
        time.sleep(20)

        for i in EXTENSIONS:
            self.load_extension("musicbot.cogs." + i)
Пример #8
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)
Пример #9
0
    def __init__ (self) :
        super().__init__ (
            intents=intents
        )
        self.remove_command("help")

        # Lavalink Download
        if not os.path.exists("Lavalink.jar"):
            LOGGER.info("Lavalink Downloading...")
            a = requests.get("https://api.github.com/repos/Cog-Creators/Lavalink-Jars/releases")
            b = json.loads(a.text)
            request.urlretrieve(f"https://github.com/Cog-Creators/Lavalink-Jars/releases/download/{b[0]['tag_name']}/Lavalink.jar", "Lavalink.jar")
        
        process = multiprocessing.Process(target=child_process)
        process.start()
        time.sleep(20)

        for i in EXTENSIONS :
            self.load_extension("musicbot.cogs." + i)
Пример #10
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)
Пример #11
0
 async def on_voice_state_update(self, member, before, after):
     try:
         voice_channel = self.bot.get_channel(int(before.channel.id))
         player = self.bot.lavalink.player_manager.get(int(voice_channel.guild.id))
         members = voice_channel.members
         mem = []
         nobot = []
         if not members == []:
             for m in members:
                 mem.append(m.id)
                 if not m.bot:
                     nobot.append(m.id)
             if self.bot.user.id in mem:
                 if len(nobot) == 0:
                     player.queue.clear()
                     await player.stop()
                     await self.connect_to(voice_channel.guild.id, None)
                     LOGGER.info(f"{voice_channel} 음성채널에 봇만 남았으므로 자동 연결해제")
     except Exception as a:
         print(a)
Пример #12
0
 async def reload(self, ctx, module):
     """ 모듈을 리로드합니다. """
     try:
         self.bot.reload_extension("musicbot.cogs." + module)
         LOGGER.info(f"리로드 성공!\n모듈 : {module}")
         embed = discord.Embed(
             title=get_lan(ctx.author.id, "owners_reload_success"),
             description=get_lan(ctx.author.id,
                                 "owners_module").format(module=module),
             color=self.color)
     except Exception as error:
         LOGGER.error(f"리로드 실패!\n에러 : {error}")
         embed = discord.Embed(title=get_lan(ctx.author.id,
                                             "owners_reload_fail"),
                               description=f'에러 : {error}',
                               color=self.error_color)
         if module in EXTENSIONS:
             EXTENSIONS[EXTENSIONS.index(module)] = f"*~~{module}~~*"
     embed.set_footer(text=BOT_NAME_TAG_VER)
     await ctx.respond(embed=embed)
Пример #13
0
def setup(bot):
    bot.add_cog(Help(bot))
    LOGGER.info('Help loaded!')
Пример #14
0
def setup(bot: commands.Bot):
    bot.add_cog(school(bot))
    LOGGER.info("school loaded!")
Пример #15
0
def setup(bot):
    bot.add_cog(Ping(bot))
    LOGGER.info('Ping loaded!')
Пример #16
0
def setup(bot):
    bot.add_cog(lostArk(bot))
    LOGGER.info("lostArk loaded!")
Пример #17
0
def setup(bot):
    bot.add_cog(Owners(bot))
    LOGGER.info('Owners Loaded!')
Пример #18
0
def setup(bot):
    bot.add_cog(emojigenerator(bot))
    LOGGER.info("mojigenerator loaded!")
Пример #19
0
def setup(bot):
    bot.add_cog(randomteam(bot))
    LOGGER.info("randomteam loadded")
Пример #20
0
def setup(bot):
    bot.add_cog(addcoin(bot))
    LOGGER.info('addcoin Loaded!')
Пример #21
0
def setup(bot):
    bot.add_cog(profile(bot))
    LOGGER.info("profile loaded!")
Пример #22
0
def setup (bot) :
    bot.add_cog (addr (bot))
    LOGGER.info('addr loaded!')
Пример #23
0
def setup(bot):
    bot.add_cog(Language(bot))
    LOGGER.info('Language loaded!')
Пример #24
0
def setup(bot):
    bot.add_cog(Chart(bot))
    LOGGER.info('Chart loaded!')
Пример #25
0
def setup(bot):
    bot.add_cog(About(bot))
    LOGGER.info('About loaded!')
Пример #26
0
def setup(bot):
    bot.add_cog(shop(bot))
    LOGGER.info('shop Loaded!')
Пример #27
0
def setup(bot):
    bot.add_cog(Music(bot))
    LOGGER.info("Music loaded!")
Пример #28
0
def setup(bot):
    bot.add_cog(Other(bot))
    LOGGER.info('Other loaded!')
Пример #29
0
def setup(bot: commands.Bot):
    bot.add_cog(shortURL(bot))
    LOGGER.info("shortURL loaded!")
Пример #30
0
def setup(bot: commands.Bot):
    bot.add_cog(autojindan(bot))
    LOGGER.info("autojindan loaded!")