コード例 #1
0
    async def reminder(self, ctx, seconds: typing.Union[int], *, reason=None):

        if not seconds >= 0:
            raise commands.BadArgument()

        if reason is not None:
            embed = Embed.check(
                title="리마인더",
                description="리마인더에 기록 완료했어요! %s초 있다가 `%s`하라고 알려드릴께요!" %
                (str(seconds), reason),
            )
        else:
            embed = Embed.check(
                title="리마인더",
                description="리마인더에 기록 완료했어요! %s초 있다가 알려드릴께요!" % (str(seconds)),
            )

        embed.set_footer(text="봇이 꺼지면 초기화됩니다!")
        await ctx.send(embed=embed)
        await asyncio.sleep(seconds)
        await ctx.send(ctx.author.mention)
        embed = discord.Embed(title="⏰ 알림",
                              description="시간이 다 되었어요!",
                              color=0x1DC73A)
        if reason is not None:
            embed.add_field(name="내용", value=reason)
        await ctx.send(embed=embed)
コード例 #2
0
    async def kick(self, ctx, member: discord.Member):

        await ctx.guild.kick(member,
                             reason=str(ctx.author) +
                             "님의 명령어 사용으로 인해 킥 당하셨습니다.")
        embed = Embed.check(title="멤버 킥", description="선택한 유저를 추방했어요.")
        await ctx.send(embed=embed)
コード例 #3
0
    async def qna(self, ctx, *, args):

        msg = await ctx.send(
            "정말로 전송할까요? 의미 없는 내용을 전송하시면 **블랙추가** 됨을 확인해주세요.\n전송을 원하시면 ✅ 를 눌러주세요."
        )
        await msg.add_reaction("✅")

        def posi_check(reaction, user):
            # if user.is_bot: return False
            return (user == ctx.author and str(reaction.emoji) == "✅"
                    and msg.id == reaction.message.id)

        answer = await self.bot.wait_for("reaction_add",
                                         check=posi_check,
                                         timeout=10)
        bgm = self.bot.get_user(289729741387202560)
        embed = discord.Embed(
            title="❔ 건의가 도착했어요!",
            description=args,
            color=0x1DC73A,
            timestamp=datetime.datetime.utcnow(),
        )
        embed.set_footer(
            icon_url=ctx.author.avatar_url,
            text="{} / {}".format(ctx.author, ctx.author.id),
        )
        await bgm.send(embed=embed)
        embed = Embed.check(title="성공", description="건의 전송을 성공했어요!")
        await ctx.send(embed=embed)
コード例 #4
0
 async def ban(self, ctx, member: discord.Member):
     await ctx.guild.ban(
         member,
         reason=str(ctx.author) + "님의 명령어 사용으로 인해 밴 당하셨습니다.",
         delete_message_days=7,
     )
     embed = Embed.check(title="유저 밴", description="유저의 밴을 완료했어요.")
     await ctx.send(embed=embed)
コード例 #5
0
    async def choose_user(self, ctx):

        embed = Embed.check(
            title="뽑기 성공",
            description="{}님이 뽑혔어요!".format(
                random.choice(ctx.guild.members).mention),
        )
        await ctx.send(embed=embed)
コード例 #6
0
 async def delete_message(self, ctx, amount: typing.Union[int]):
     if amount > 0 and amount <= 100:
         deleted_message = await ctx.channel.purge(limit=amount)
         embed = Embed.check(
             title="메시지 삭제",
             description="%s개의 메시지를 지웠어요." % len(deleted_message),
         )
         await ctx.send(embed=embed, delete_after=3)
     else:
         embed = Embed.warn(title="오류 발생",
                            description="지우는 메시지의 개수는 1개~100개여야 해요.")
         await ctx.send(embed=embed, delete_after=3)
コード例 #7
0
    async def jolly(self, ctx, *, args):
        args = args.lstrip()
        database = [
            "절",
            "절절",
            "리",
            "가루",
            "브금",
            " ",
            "동묘",
            "와이",
            "라마",
            "나무",
            "절절"
            "형",
            "pb",
            "ㅎㅌ",
            "순수",
            "순순",
            "순",
            "y",
            "",
            "띵큐",
            "잠수",
            "잠수",
            "나무",
            "루비",
            "루",
            "라미",
            "폭",
            "라타",
            "호준",
        ]

        target_list = list(args)
        translated_list = [
            sum([int(j) for j in str(ord(x))]) for x in target_list
        ]
        new = [
            database[x] if x < len(database) - 1 else database[(x %
                                                                len(database))]
            for x in translated_list
        ]
        embed = Embed.check(title="라타어 번역", description="".join(new))
        await ctx.send(embed=embed)
コード例 #8
0
ファイル: chatting.py プロジェクト: khk4912/NEO-Bot
    async def reminder(self, ctx, *, args):
        rmd_pat = r"(\d{1,2}h)?\s?(\d{1,2}m)?\s?(\d*s)?"
        hms = re.search(rmd_pat, args)
        hms_group = hms.groups()
        if hms_group == (None, None, None):
            # Embed.warn(
            #     "주의",
            #     "시간 파싱에 실패했어요. 아래 예시를 참고해주세요.\n\n`봇 리마인더 3h` (3시간)\n`봇 리마인더 1h 30m` (1시간 30분)\n`봇 리마인더 20s` (20초)",
            # )
            raise commands.BadArgument()
        reason = args.replace(hms.group(0), "")
        hour = (int(hms_group[0].split("h")[0])
                if hms_group[0] is not None else 0)
        minute = (int(hms_group[1].split("m")[0])
                  if hms_group[1] is not None else 0)
        seconds = (int(hms_group[2].split("s")[0])
                   if hms_group[2] is not None else 0)

        total_seconds = hour * 3600 + minute * 60 + seconds

        n_hour = total_seconds // 3600
        n_minutes = total_seconds % 3600 // 60
        n_seconds = total_seconds % 3600 % 60
        embed = Embed.check(
            "리마인더", f"{n_hour}시간 {n_minutes}분 {n_seconds}초 후에 알려드릴께요!")
        print(reason)
        if not reason == "":
            embed.add_field(name="사유", value=reason)
        embed.set_footer(text="봇이 종료되면 울리지 않아요!")
        await ctx.send(embed=embed)
        await asyncio.sleep(total_seconds)
        await ctx.send(ctx.author.mention)
        embed = discord.Embed(title="⏰ 알림",
                              description="시간이 다 되었어요!",
                              color=0x1DC73A)
        if not reason == "":
            embed.add_field(name="사유", value=reason)
        await ctx.send(embed=embed)
コード例 #9
0
 async def channel_unmute(self, ctx):
     await ctx.channel.set_permissions(ctx.guild.default_role,
                                       send_messages=None)
     embed = Embed.check("채널 얼리기 해제", "채널 얼리기를 해제했어요.")
     await ctx.send(embed=embed)
コード例 #10
0
 async def channel_mute(self, ctx):
     await ctx.channel.set_permissions(ctx.guild.default_role,
                                       send_messages=False)
     embed = Embed.check("채널 얼리기",
                         "관리자를 제외한 모든 유저는 이제 이 채널에 메시지를 보낼 수 없어요.")
     await ctx.send(embed=embed)
コード例 #11
0
 async def unmute_user(self, ctx, member: discord.Member):
     await ctx.channel.set_permissions(member, send_messages=None)
     embed = Embed.check("유저 언뮤트", "해당 유저를 이 채널에서 언뮤트했어요!")
     await ctx.send(embed=embed)