Example #1
0
 async def warns(self, ctx, *, user: discord.Member = None):
     if user is None:
         user = ctx.author
     with open("./configs/warns.json", "r") as f:
         pp = json.load(f)
     try:
         guild = pp[str(ctx.guild.id)]
         wew = list(guild[str(user.id)])
     except KeyError:
         with open("./configs/warns.json", "w") as ra:
             pp[str(ctx.guild.id)] = {str(user.id): []}
             json.dump(pp, ra, indent=4)
     guild = pp[str(ctx.guild.id)]
     warns = []
     u = 0
     for w in guild[str(user.id)]:
         u = u + 1
         warns.append(f"{str(u)}. {w}")
     if warns is []:
         d = "No Warns"
     else:
         d = '\n'.join(warns)
     if d is "":
         d = "No Warns"
     e = Embed(
         title=f"Warns for {user}",
         description="{}".format(d),
         color=emcolor)
     footerd(e)
     await ctx.send(embed=e)
Example #2
0
 async def fun(self, ctx):
     await ctx.trigger_typing()
     e = discord.Embed(
         title='Fun Commands',
         description=f'Current prefix is `{prefix(ctx.message)}`.\n\n'
         f"`{prefix(ctx.message)}8ball [question]` - Magic 8Ball.\n"
         f"`{prefix(ctx.message)}gifsearch [query]` - Finds the gif online.\n"
         f"`{prefix(ctx.message)}imgsearch [query]` - Finds an image online.\n"
         f"`{prefix(ctx.message)}encode [text]` - Encodes a message to Base64.\n"
         f"`{prefix(ctx.message)}decode [text]` - Decodes a message from Base64.\n"
         f"`{prefix(ctx.message)}spacetext [text]` - Adds spaces between letters.\n"
         f"`{prefix(ctx.message)}ascii [text]` - Makes a large text.\n"
         f"`{prefix(ctx.message)}regional [text]` - Makes a text in regional indicator font.\n"
         f"`{prefix(ctx.message)}hack <user>` - Hacks a user. (fake)\n"
         f"`{prefix(ctx.message)}findip <user>` - Finds a user's IP (fake)\n"
         f"`{prefix(ctx.message)}clap [text]` - Adds claps between words.\n"
         f"`{prefix(ctx.message)}1337 [text]` - 1337 speak.\n"
         f"`{prefix(ctx.message)}embed [query]` - Makes an embed with given queries.\n"
         f"`{prefix(ctx.message)}unfunny` - Tells someone how unfunny they are.\n"
         f"`{prefix(ctx.message)}dice` - Rolls a virtual dice\n"
         f"`{prefix(ctx.message)}flipcoin` - Flips a virtual coin.\n"
         f"`{prefix(ctx.message)}iq <user>` - How smart a user is.\n"
         f"`{prefix(ctx.message)}howgay <user>` - How gay someone is.\n"
         f"`{prefix(ctx.message)}howsimp <user>` - How much of a simp someone is.\n",
         color=emcolor,
         timestamp=datetime.datetime.utcnow())
     footerd(e)
     await ctx.send(embed=e)
Example #3
0
    async def fetch_userinfo(self, ctx, id_: int = None):
        if id_ == None:
            return await ctx.send(
                f"You need to provide someone to fetch their profile.\nUsage: `{prefix(ctx.message)}fetchuser [user-id]`"
            )
        user = await self.bot.fetch_user(id_)
        e = discord.Embed(title='User Info', color=emcolor)
        fields = [{
            'name': 'Username',
            'value': f'{user}'
        }, {
            'name': 'ID',
            'value': str(user.id)
        }, {
            'name': "Profile Picture",
            'value': f'[Direct Link]({user.avatar_url})'
        }, {
            'name': "Created At",
            'value': user.created_at.strftime("%d/%m/%Y at %H:%M:%S UTC")
        }]
        for field in fields:
            if field['value']:
                e.add_field(name=field['name'],
                            value=field['value'],
                            inline=True)
        e.set_thumbnail(url=user.avatar_url)
        e.set_author(name=f'{user}', icon_url=user.avatar_url)
        footerd(e)

        await ctx.send(embed=e)
Example #4
0
 async def eight_ball_answr(self, ctx, *, question=None):
     if question == None:
         return await ctx.send(
             f"You need to provide something to .\nUsage: `{prefix(ctx.message)} [text]`"
         )
     else:
         answers = [
             'Possibly.', 'Ask Again Later...', 'Try Again.',
             'It\'s Certain.', 'Most Likely No', 'Most Likely Yes', 'No.',
             'Yes.', 'Definetly a Yes.', 'Definetly a No.',
             'What did you expected?', 'Cannot answer now, try again.',
             "It is certain", "It is decidedly so", "Without a doubt",
             "Yes, definitely", "You may rely on it", "As I see it, yes",
             "Most likely", "Outlook good", "Yes", "Signs point to yes",
             "Reply hazy try again", "Ask again later",
             "Better not tell you now", "Cannot predict now",
             "Concentrate and ask again", "Don't count on it",
             "My reply is no", "My sources say no", "Outlook not so good",
             "Very doubtful"
         ]
         embed = discord.Embed(
             title='8ball',
             description=
             f"\n\n**Question Asked:**\n{question}\n\n**Answer:**\n*{random.choice(answers)}*",
             colour=emcolor)
         footerd(embed)
         await ctx.send(embed=embed)
Example #5
0
 async def randnum(self, ctx, min: int, max: int):
     var32_1 = discord.Embed(
         title='Random Number Generator!',
         description=
         f'Requested by {ctx.author.mention}\n\nMinimum = `{min}`\nMaximum = `{max}`\n\nRandom Number is: `{random.randint(min, max)}`',
         colour=emcolor)
     footerd(var32_1)
     await ctx.channel.send("", embed=var32_1)
Example #6
0
 async def userinfo(self, ctx, user: discord.Member = None):
     if user == None:
         user = ctx.author
     e = discord.Embed(title='User Info', color=emcolor)
     if len(user.roles) > 1:
         role_string = ', '.join([f"**`{r.name}`**"
                                  for r in user.roles][1:])
     else:
         role_string = 'No Roles'
     if 'Administrator' in [
             str(p[0]).replace("_", " ").title()
             for p in user.guild_permissions if p[1]
     ]:
         perm_string = 'All Permissions'
     else:
         perm_string = ', '.join([
             str(p[0]).replace("_", " ").title()
             for p in user.guild_permissions if p[1]
         ])
     fields = [{
         'name': 'Username',
         'value': f'{user}'
     }, {
         'name': 'ID',
         'value': str(user.id)
     }, {
         'name': "Profile Picture",
         'value': f'[Direct Link]({user.avatar_url})'
     }, {
         'name': 'Top Role',
         'value': user.top_role.mention
     }, {
         'name': "Role Count",
         'value': f'{len(user.roles)}'
     }, {
         'name': "Created At",
         'value': user.created_at.strftime("%d/%m/%Y at %H:%M:%S UTC")
     }, {
         'name': "Joined Server At",
         'value': user.joined_at.strftime("%d/%m/%Y at %H:%M:%S UTC")
     }, {
         'name': "Roles",
         'value': role_string
     }]
     for field in fields:
         if field['value']:
             try:
                 e.add_field(name=field['name'],
                             value=field['value'],
                             inline=True)
             except Exception as _er:
                 await ctx.send("```{}```".format(_er))
     e.add_field(name="Permissions", value=perm_string, inline=False)
     e.set_thumbnail(url=user.avatar_url)
     e.set_author(name=f'{user}', icon_url=user.avatar_url)
     footerd(e)
     await ctx.send(embed=e)
Example #7
0
 async def help(self, ctx):
     await ctx.trigger_typing()
     emb = discord.Embed(title='Help Commands',
                         description='Current prefix is `{}`'.format(
                             prefix(ctx.message)),
                         color=emcolor,
                         timestamp=datetime.datetime.utcnow())
     fields = [{
         'name':
         '🎈 Fun',
         'value':
         f"`{prefix(ctx.message)}help fun`\nA list of some fun and random commands you could use."
     }, {
         'name':
         '📷 Image',
         'value':
         f"`{prefix(ctx.message)}help image`\nImage commands, there's lots here too."
     }, {
         'name':
         'âž• Math',
         'value':
         f"`{prefix(ctx.message)}help math`\nYou need help in math? Here's the calculator."
     }, {
         'name':
         '🎉 Giveaway',
         'value':
         f"`{prefix(ctx.message)}help giveaway`\nGiveaway commands are used a lot. How can we not have it?"
     }, {
         'name':
         '✨ Miscellaneous',
         'value':
         f"`{prefix(ctx.message)}help misc`\nMiscellaneous commands are also here."
     }, {
         'name':
         '🔧 Moderation',
         'value':
         f"`{prefix(ctx.message)}help mod`\nModeration, used to help moderate your server."
     }, {
         'name':
         '📨 Utilities',
         'value':
         f"`{prefix(ctx.message)}help utils`\nUtility commands, ping command, bot-info, etc.."
     }, {
         'name':
         'âš™ Configuration',
         'value':
         f"`{prefix(ctx.message)}help config`\nConfiguration commands for the server, includes custom server prefixes."
     }]
     for field in fields:
         if field['value']:
             emb.add_field(name=field['name'],
                           value=field['value'],
                           inline=False)
     footerd(emb)
     await ctx.send(embed=emb)
Example #8
0
 async def config(self, ctx):
     await ctx.trigger_typing()
     e = discord.Embed(
         title='Configuration Commands',
         description=f'Current prefix is `{prefix(ctx.message)}`.\n\n'
         f"`{prefix(ctx.message)}setprefix <prefix>` - Sets a custom prefix for your server.\n"
         f"`{prefix(ctx.message)}muterole <@role>` - Sets the muterole for your server.\n",
         color=emcolor,
         timestamp=datetime.datetime.utcnow())
     footerd(e)
     await ctx.send(embed=e)
Example #9
0
 async def math_add_cmd(self,
                        ctx,
                        arg9: int,
                        arg10: int,
                        n1: int = '0',
                        n2: int = '0'):
     emb = discord.Embed(description=f'{mfmath.add(arg9, arg10, n1, n2)}',
                         color=emcolor)
     emb.set_author(name='Calculator', icon_url=ctx.author.avatar_url)
     footerd(emb)
     await ctx.channel.send(mfmath.add(arg9, arg10, n1, n2))
Example #10
0
 async def giveaway(self, ctx):
     await ctx.trigger_typing()
     e = discord.Embed(
         title='Giveaway Commands',
         description=f'Current prefix is `{prefix(ctx.message)}`.\n\n'
         f"`{prefix(ctx.message)}gstart` - Asks some questions and starts a giveaway.\n"
         f"`{prefix(ctx.message)}greroll [msg-id]` - Re-rolls a giveaway.\n"
         f"`{prefix(ctx.message)}gend [msg-id]` - Ends a giveway before the supposed time.",
         color=emcolor,
         timestamp=datetime.datetime.utcnow())
     footerd(e)
     await ctx.send(embed=e)
Example #11
0
 async def utils(self, ctx):
     await ctx.trigger_typing()
     e = discord.Embed(
         title='Utility Commands',
         description=f'Current prefix is `{prefix(ctx.message)}`.\n\n'
         f"`{prefix(ctx.message)}ping` - Checks the bot's ping.\n"
         f"`{prefix(ctx.message)}pingweb [http]` - Pings a website and checks the status.\n"
         f"`{prefix(ctx.message)}invite` - Invite link for the bot.\n",
         color=emcolor,
         timestamp=datetime.datetime.utcnow())
     footerd(e)
     await ctx.send(embed=e)
Example #12
0
 async def end_giveaway(self, ctx, id_: int = None):
     if id_ == None:
         return await ctx.send(
             f"You need to provide a message id to end.\nUsage: `{prefix(ctx.message)}gend [msg-id]`"
         )
     else:
         try:
             for channel in ctx.guild.text_channels:
                 try:
                     msg2 = await channel.fetch_message(int(id_))
                 except:
                     pass
         except:
             await ctx.send(embed=discord.Embed(
                 description=
                 "<:tickNo:787334378639458344> Error: ID was entered incorrectly.",
                 color=discord.Color.red()))
         users = await msg2.reactions[0].users().flatten()
         users.pop(users.index(self.bot.user))
         winner = random.choice(users)
         if msg2.content == "<:CH_present:767981864132018176> **GIVEAWAY ENDED** <:CH_present:767981864132018176>":
             await ctx.send(embed=discord.Embed(
                 description=
                 "<:tickNo:787334378639458344> Error: The giveaway was already ended.",
                 color=discord.Color.red()))
         else:
             await msg2.channel.send(
                 f"🎊 **Congratulations** {winner.mention}! You have won the giveaway!"
             )
             users = await msg2.reactions[0].users().flatten()
             users.pop(users.index(self.bot.user))
             emb = discord.Embed(
                 description=
                 f"<:tick:769432064557842442> Successfully ended giveaway in {msg2.channel.mention}",
                 color=discord.Color.green())
             embed2 = discord.Embed(
                 description=
                 f"🔰 Host: {ctx.author.mention}\n🎟 Valid Entries: {len(users)}\n🏅 Winner: \n"
                 + winner.mention + "\n",
                 colour=0x777777,
                 timestamp=timei.now)
             footerd(embed2)
             embed2.set_footer(
                 text="Ended at",
                 icon_url=
                 'https://cdn.discordapp.com/avatars/785496485659148359/0fc85eb060bb37c35726fabe791170fe.webp?size=1024'
             )
             await msg2.edit(
                 content=
                 "<:CH_present:767981864132018176> **GIVEAWAY ENDED** <:CH_present:767981864132018176>",
                 embed=embed2)
             await ctx.send(embed=emb)
Example #13
0
 async def math(self, ctx):
     await ctx.trigger_typing()
     e = discord.Embed(
         title='Math Commands',
         description=f'Current prefix is `{prefix(ctx.message)}`.\n\n'
         f"`{prefix(ctx.message)}randomnum [min] [max]` - Picks a random number between the minimum and maximum\n"
         f"`{prefix(ctx.message)}add [num] [num]` - Adds the given numbers.\n"
         f"`{prefix(ctx.message)}substract [num] [num]` - Substracts the given numbers.\n"
         f"`{prefix(ctx.message)}multiply [num] [num]` - Multiplies the given numbers.\n"
         f"`{prefix(ctx.message)}divide [num] [num]` - Divides the given numbers.\n",
         color=emcolor,
         timestamp=datetime.datetime.utcnow())
     footerd(e)
     await ctx.send(embed=e)
Example #14
0
 async def choice(self, ctx, *, args=None):
     if args == None:
         return await ctx.send(
             f"You need to provide something to .\nUsage: `{prefix(ctx.message)} [text]`"
         )
     else:
         a = args.split('|')
         b = ', '.join(a)
         embed = discord.Embed(
             title='Random Choice',
             description=
             f'\n**Choices:**\n{b}\n\n**Picked:**\n{random.choice(a)}',
             color=emcolor)
         footerd(embed)
         await ctx.send(embed=embed)
Example #15
0
 async def misc(self, ctx):
     await ctx.trigger_typing()
     e = discord.Embed(
         title='Miscellaneous Commands',
         description=f'Current prefix is `{prefix(ctx.message)}`.\n\n'
         f"`{prefix(ctx.message)}poll [options..]` - Creates a poll with the given questions.\n"
         f"`{prefix(ctx.message)}serverinfo` - Statistics for the current server.\n"
         f"`{prefix(ctx.message)}whois <user>` - Information for a user.\n"
         f"`{prefix(ctx.message)}messages <user>` - Checks amount of messages a user sent. (bugged)\n"
         f"`{prefix(ctx.message)}invites <user>` - Checks how many people were invited by a user.\n"
         f"`{prefix(ctx.message)}avatar <user>` - A user's avatar.\n"
         f"`{prefix(ctx.message)}fetchav [id]` - Fetches an avatar from a user that is not in the server.\n"
         f"`{prefix(ctx.message)}fetchuser [id]` - Fetches basic information for a user that is not in the server.\n",
         color=emcolor,
         timestamp=datetime.datetime.utcnow())
     footerd(e)
     await ctx.send(embed=e)
Example #16
0
 async def image(self, ctx):
     await ctx.trigger_typing()
     e = discord.Embed(
         title='Image Commands',
         description=f'Current prefix is `{prefix(ctx.message)}`.\n\n'
         f"`{prefix(ctx.message)}meme` - Sends a random reddit meme.\n"
         f"`{prefix(ctx.message)}ytcomment [comment]` - Makes a youtube comment.\n"
         f"`{prefix(ctx.message)}tweet [msg]` - Makes a tweet.\n"
         # f"`{prefix(ctx.message)}wanted <@user>` - Adds a wanted overlay to someone.\n"
         # f"`{prefix(ctx.message)}triggered <@user>` - Adds a triggered overlay to someone.\n"
         f"`{prefix(ctx.message)}gay` - Rainbow overlay over someone.\n"
         f"`{prefix(ctx.message)}fox` - Random Fox Image.\n"
         f"`{prefix(ctx.message)}cat` - Random Cat Image.\n"
         f"`{prefix(ctx.message)}panda` - Random Panda Image.\n"
         f"`{prefix(ctx.message)}dog` - Random Dog Image.\n"
         f"`{prefix(ctx.message)}koala` - Random Koala Image.\n"
         f"`{prefix(ctx.message)}bird` - Random Bird Image.\n",
         color=emcolor,
         timestamp=datetime.datetime.utcnow())
     footerd(e)
     await ctx.send(embed=e)
Example #17
0
 async def mod(self, ctx):
     await ctx.trigger_typing()
     e = discord.Embed(
         title='Moderation Commands',
         description=f'Current prefix is `{prefix(ctx.message)}`.\n\n'
         f"`{prefix(ctx.message)}addrole [user] [role]` - Gives a user a role.\n"
         f"`{prefix(ctx.message)}removerole [user] [role]` - Removes a user's a role.\n"
         f"`{prefix(ctx.message)}slowmode [time] <channel>` - Sets slowmode for a channel.\n"
         f"`{prefix(ctx.message)}purge [amount]` - Deletes an amount of messages for the current channel.\n"
         f"`{prefix(ctx.message)}nuke <channel>` - Deletes all messages in a channel.\n"
         f"`{prefix(ctx.message)}ban [user] <reason>` - Bans a user.\n"
         f"`{prefix(ctx.message)}kick [user] <reason>` - Kicks a user.\n"
         f"`{prefix(ctx.message)}warn [user] [reason]` - Warns a user with a specified reason.\n"
         f"`{prefix(ctx.message)}warns <user>` - Checks warnings for a user.\n"
         f"`{prefix(ctx.message)}clearwarns [user]` - Removes a user's warnings.\n"
         f"`{prefix(ctx.message)}mute [user] <mins>` - Mutes a user for an amount of minutes.\n"
         f"`{prefix(ctx.message)}unmute [user]` - Unmutes a user that is muted.\n"
         f"`{prefix(ctx.message)}setup` - Sets up the muterole for the current server.",
         color=emcolor,
         timestamp=datetime.datetime.utcnow())
     footerd(e)
     await ctx.send(embed=e)
Example #18
0
 async def serverstats(self, ctx):
     embed = discord.Embed(title='Server Info',
                           description=f'Info for Guild: **{ctx.guild}**',
                           colour=emcolor)
     if ctx.guild.features == []:
         perk_strng = 'No Perks'
     else:
         perk_strng = ', '.join([
             str(p).replace("_", " ").title() for p in ctx.guild.features
             if p[1]
         ])
     embed.set_thumbnail(url=ctx.guild.icon_url)
     embed.add_field(name="Guild Name",
                     value=f"{ctx.guild.name}",
                     inline=True)
     embed.add_field(name='Roles', value=f'{len(ctx.guild.roles)}')
     embed.add_field(name='Guild Logo',
                     value=f'[Direct Link]({ctx.guild.icon_url})',
                     inline=True)
     embed.add_field(name='Members', value=f"{ctx.guild.member_count}")
     embed.add_field(name='Owner',
                     value=f'<@!{ctx.message.author.guild.owner_id}>',
                     inline=True)
     embed.add_field(
         name='Channels',
         value=
         f'<:vc:790390770112266280> {len(ctx.guild.text_channels)}\n<:tc:790390769902944286> {len(ctx.guild.voice_channels)}'
     )
     embed.add_field(name="Guild ID", value=ctx.guild.id, inline=True)
     embed.add_field(
         name="Created At",
         value=ctx.guild.created_at.strftime("%d/%m/%Y at %H:%M:%S UTC"),
         inline=True)
     embed.add_field(name='Region', value=ctx.guild.region, inline=True)
     embed.add_field(name='VIP Perks', value=perk_strng)
     footerd(embed)
     await ctx.send(embed=embed)
Example #19
0
    async def gstart(self, ctx):
        answers = []

        def check(m):
            return m.author == ctx.author and m.channel == ctx.channel

        await ctx.channel.send(embed=discord.Embed(
            description=
            f'Let\'s start! Please mention where you want to giveaway to be.\nExample: {ctx.channel.mention}',
            color=emcolor))
        try:
            msg = await self.bot.wait_for('message', timeout=45.0, check=check)
        except asyncio.TimeoutError:
            return await ctx.channel.send(embed=Embed(
                description=
                f'<:tickNo:787334378639458344> You did not answered fast enough. Try again by typing `{prefix}gstart`',
                color=Color.red()))
        else:
            answers.append(msg.content)
        if answers[0] == 'cancel':
            return await ctx.channel.send(embed=Embed(
                description=f'<:tickNo:787334378639458344> Command cancelled.',
                color=Color.red()))
        try:
            yes = False
            c_id = int(answers[0][2:-1])
            for channel in ctx.guild.text_channels:
                if channel.id == c_id:
                    yes = True
                else:
                    pass
            if yes == False:
                return await ctx.channel.send(embed=Embed(
                    description=
                    f'<:tickNo:787334378639458344> You didn\'t mention the channel properly. Example: {ctx.channel.mention}.',
                    color=Color.red()))
        except:
            return await ctx.channel.send(embed=Embed(
                description=
                f'<:tickNo:787334378639458344> You didn\'t mention the channel properly. Example: {ctx.channel.mention}.',
                color=Color.red()))
        await ctx.channel.send(embed=discord.Embed(
            description=
            f'🎉 Ok, set channel as <#{c_id}>. 🎉\nPlease enter the time for the giveaway before it rolls.\nFor example: `15s 2m 3h 4d`',
            color=emcolor))
        try:
            msg = await self.bot.wait_for('message', timeout=45.0, check=check)
        except asyncio.TimeoutError:
            return await ctx.channel.send(embed=Embed(
                description=
                f'<:tickNo:787334378639458344> You did not answered fast enough. Try again by typing `{prefix}gstart`',
                color=Color.red()))
        else:
            answers.append(msg.content)
        if str(answers[1]) == 'cancel':
            return await ctx.channel.send(embed=Embed(
                description=f'<:tickNo:787334378639458344> Command cancelled.',
                color=Color.red()))

        def convert(t):
            times = t.split()
            pos = ['s', 'm', 'h', 'd']
            time_dict = {'s': 1, 'm': 60, 'h': 3600, 'd': 3600 * 24}
            final = 0
            for time in times:
                unit = time[-1]
                if unit not in pos:
                    return -1
                try:
                    val = int(time[:-1])
                except:
                    return -2
                final = final + val * time_dict[unit]
            return final

        def __convert__(time):
            jsd = time.split(' ')
            isd = []
            for i in jsd:
                pos = ['s', 'm', 'h', 'd']
                tdic = {
                    's': 'seconds',
                    'm': 'minutes',
                    'h': 'hours',
                    'd': 'days'
                }
                unit = i[-1]
                if unit not in pos:
                    return -1
                try:
                    val = int(i[:-1])
                except:
                    return -2
                isd.append(f"{str(val)} {tdic[unit]}")
            return ' '.join(isd)

        try:
            time = convert(answers[1])
            s = str(datetime.timedelta(seconds=time)).split(':')
            if s[0].startswith("0") and s[0].endswith("0"):
                if s[1].startswith("0"):
                    if s[2].startswith("0"):
                        g = str(s[1])[1]
                        yss = g + ' minutes ' + str(s[2])[1] + ' seconds'
                    elif s[2].startswith("0") and s[2].endswith("0"):
                        g = str(s[2])[1]
                        yss = g + ' minutes'
                    else:
                        g = str(s[1])[1]
                        yss = g + ' minutes ' + s[2] + ' seconds'
                else:
                    yss = s[1] + ' minutes ' + s[2] + ' seconds'
            else:
                yss = s[0] + ' hours ' + s[1] + ' minutes ' + s[2] + ' seconds'
            ys = yss
            __ys__ = __convert__(answers[1])
        except Exception as _e:
            await ctx.send("```{}```".format(_e))
        if convert(answers[1]) > 59:
            pass
        else:
            return await ctx.send(embed=Embed(
                description=
                f'<:tickNo:787334378639458344> The time cannot be shorter than 1 minute.',
                color=Color.red()))
        if time == -1:
            return await ctx.channel.send(embed=Embed(
                description=
                f'<:tickNo:787334378639458344> You didn\'t enter the time properly. Example: `15s 2m 3h 4d`.',
                color=Color.red()))
        elif time == -2:
            return await ctx.channel.send(embed=Embed(
                description=
                f'<:tickNo:787334378639458344> You didn\'t enter the time properly. Please enter an integer (number) next time.',
                color=Color.red()))
        await ctx.channel.send(embed=discord.Embed(
            description=
            f'🎉 Ok, time has been set to **{__ys__}** 🎉\nPlease enter the prize for the giveaway.',
            color=emcolor))
        try:
            msg = await self.bot.wait_for('message', timeout=45.0, check=check)
        except asyncio.TimeoutError:
            return await ctx.channel.send(embed=Embed(
                description=
                f'<:tickNo:787334378639458344> You did not answered fast enough. Try again by typing `{prefix}gstart`',
                color=Color.red()))
        else:
            answers.append(msg.content)
        if answers[2] == 'cancel':
            return await ctx.channel.send(embed=Embed(
                description=f'<:tickNo:787334378639458344> Command cancelled.',
                color=Color.red()))
        await ctx.channel.send(embed=discord.Embed(
            description=
            f'🎉 Ok, the prize is set to **{answers[2]}**. 🎉\nPlease enter how much winners needed for this giveaway. (max: 25)\nThis will also start the giveaway.',
            color=emcolor))
        try:
            msg = await self.bot.wait_for('message', timeout=45.0, check=check)
        except asyncio.TimeoutError:
            return await ctx.channel.send(embed=Embed(
                description=
                f'<:tickNo:787334378639458344> You did not answered fast enough. Try again by typing `{prefix}gstart`',
                color=Color.red()))
        else:
            answers.append(msg.content)
        if answers[3] == 'cancel':
            return await ctx.channel.send(embed=Embed(
                description=f'<:tickNo:787334378639458344> Command cancelled.',
                color=Color.red()))
        try:
            wnrs = int(answers[3])
        except:
            return await ctx.channel.send(embed=Embed(
                description=
                f'<:tickNo:787334378639458344> Invalid answer. The **amount of winners** must be an integer (number).',
                color=Color.red()))
        channel = self.bot.get_channel(c_id)
        end = datetime.datetime.utcnow() + datetime.timedelta(seconds=time)
        prize = answers[2]
        if int(answers[3]) < 25:
            win_amount = int(answers[3])
        else:
            win_amount = 25
        msg = await channel.send("<a:dicegif:786111161036701736>")
        try:
            embed = discord.Embed(
                description=
                f"🏅 Winners: {str(wnrs)}\n⌛ Time Remaining: **{__ys__}**\n🔰 Host: {ctx.author.mention}\nReact to 🎉 to enter the giveaway!\n\nIf the giveaway does not end automatically,\nuse `{prefix(ctx.message)}gend {msg.id}`",
                colour=discord.Color.blue(),
                timestamp=end)
            footerd(embed)
            embed.set_footer(
                text="Ends at",
                icon_url=
                'https://cdn.discordapp.com/avatars/785496485659148359/0fc85eb060bb37c35726fabe791170fe.webp?size=1024'
            )
            embed.set_author(
                name=str(prize),
                icon_url=
                "https://cdn.discordapp.com/attachments/743425064921464833/767981650070994984/86c9a4dde5bb348b53f2fb7ff099e9d5-square-wrapped-gift-box-by-vexels.png"
            )
            await msg.edit(
                content=
                "<:present:767981864132018176> **GIVEAWAY** <:present:767981864132018176>",
                embed=embed)
            await msg.add_reaction("🎉")
            await ctx.send(
                ctx.author.mention,
                embed=discord.Embed(
                    description=
                    f"<:tick:769432064557842442> Successfully started giveaway in {channel.mention}",
                    color=discord.Color.green()))
        except Exception as e:
            await ctx.send("```{}```".format(e))
        await asyncio.sleep(3)
        time = time - 3
        embed = discord.Embed(
            description=
            f"🏅 Winners: {str(wnrs)}\n⌛ Time Remaining: **{ys}**\n🔰 Host: {ctx.author.mention}\nReact to 🎉 to enter the giveaway!\n\nIf the giveaway does not end automatically,\nuse `{prefix(ctx.message)}gend {msg.id}`",
            colour=discord.Color.blue(),
            timestamp=end)
        footerd(embed)
        embed.set_footer(
            text="Ends at",
            icon_url=
            'https://cdn.discordapp.com/avatars/785496485659148359/0fc85eb060bb37c35726fabe791170fe.webp?size=1024'
        )
        embed.set_author(
            name=str(prize),
            icon_url=
            "https://cdn.discordapp.com/attachments/743425064921464833/767981650070994984/86c9a4dde5bb348b53f2fb7ff099e9d5-square-wrapped-gift-box-by-vexels.png"
        )
        s = str(datetime.timedelta(seconds=time)).split(':')
        if s[0].startswith("0") and s[0].endswith("0"):
            if s[1].startswith("0"):
                if s[2].startswith("0"):
                    g = str(s[1])[1]
                    yss = g + ' minutes ' + str(s[2])[1] + ' seconds'
                else:
                    g = str(s[1])[1]
                    yss = g + ' minutes ' + s[2] + ' seconds'
            elif s[1].startswith("0") and s[2] == "00":
                g = str(s[2])[1]
                yss = g + ' minutes'
            else:
                yss = s[1] + ' minutes ' + s[2] + ' seconds'
        else:
            yss = s[0] + ' hours ' + s[1] + ' minutes ' + s[2] + ' seconds'
        if yss.endswith("00 minutes 00 seconds"):
            yss = s[0] + " hours"
        ys = yss
        await msg.edit(
            content=
            "<:present:767981864132018176> **GIVEAWAY** <:present:767981864132018176>",
            embed=embed)
        await asyncio.sleep(15)
        while time > 60:
            time = time - 15
            embed = discord.Embed(
                description=
                f"🏅 Winners: {str(wnrs)}\n⌛ Time Remaining: **{ys}**\n🔰 Host: {ctx.author.mention}\nReact to 🎉 to enter the giveaway!\n\nIf the giveaway does not end automatically,\nuse `{prefix(ctx.message)}gend {msg.id}`",
                colour=discord.Color.blue(),
                timestamp=end)
            footerd(embed)
            embed.set_footer(
                text="Ends at",
                icon_url=
                'https://cdn.discordapp.com/avatars/785496485659148359/0fc85eb060bb37c35726fabe791170fe.webp?size=1024'
            )
            embed.set_author(
                name=str(prize),
                icon_url=
                "https://cdn.discordapp.com/attachments/743425064921464833/767981650070994984/86c9a4dde5bb348b53f2fb7ff099e9d5-square-wrapped-gift-box-by-vexels.png"
            )
            s = str(datetime.timedelta(seconds=time)).split(':')
            if s[0].startswith("0") and s[0].endswith("0"):
                if s[1].startswith("0"):
                    if s[2].startswith("0"):
                        g = str(s[1])[1]
                        yss = g + ' minutes ' + str(s[2])[1] + ' seconds'
                    else:
                        g = str(s[1])[1]
                        yss = g + ' minutes ' + s[2] + ' seconds'
                elif s[1].startswith("0") and s[2] == "00":
                    g = str(s[2])[1]
                    yss = g + ' minutes'
                else:
                    yss = s[1] + ' minutes ' + s[2] + ' seconds'
            else:
                yss = s[0] + ' hours ' + s[1] + ' minutes ' + s[2] + ' seconds'
            if yss.endswith("00 minutes 00 seconds"):
                yss = s[0] + " hours"
            ys = yss
            await msg.edit(
                content=
                "<:present:767981864132018176> **GIVEAWAY** <:present:767981864132018176>",
                embed=embed)
            await asyncio.sleep(15)
        while time > 20:
            time = time - 5
            embed = discord.Embed(
                description=
                f"🏅 Winners: {str(wnrs)}\n⌛ Time Remaining: **{ys}**\n🔰 Host: {ctx.author.mention}\nReact to 🎉 to enter the giveaway!\n\nIf the giveaway does not end automatically,\nuse `{prefix(ctx.message)}gend {msg.id}`",
                colour=discord.Color.blue(),
                timestamp=end)
            footerd(embed)
            embed.set_footer(
                text="Ends at",
                icon_url=
                'https://cdn.discordapp.com/avatars/785496485659148359/0fc85eb060bb37c35726fabe791170fe.webp?size=1024'
            )
            embed.set_author(
                name=str(prize),
                icon_url=
                "https://cdn.discordapp.com/attachments/743425064921464833/767981650070994984/86c9a4dde5bb348b53f2fb7ff099e9d5-square-wrapped-gift-box-by-vexels.png"
            )
            s = str(datetime.timedelta(seconds=time)).split(':')
            if s[0].startswith("0") and s[0].endswith("0"):
                if s[1].startswith("0"):
                    if s[2].startswith("0"):
                        yss = str(s[2])[1] + ' seconds'
                    else:
                        yss = s[2] + ' seconds'
                else:
                    yss = s[1] + ' minutes ' + s[2] + ' seconds'
            else:
                yss = s[0] + ' hours ' + s[1] + ' minutes ' + s[2] + ' seconds'
            ys = yss
            await msg.edit(
                content=
                "<:present:767981864132018176> **GIVEAWAY** <:present:767981864132018176>",
                embed=embed)
            await asyncio.sleep(5)
        while time > 7:
            time = time - 3
            embed = discord.Embed(
                description=
                f"🏅 Winners: {str(wnrs)}\n⌛ Time Remaining: **{ys}**\n🔰 Host: {ctx.author.mention}\nReact to 🎉 to enter the giveaway!\n\nIf the giveaway does not end automatically,\nuse `{prefix(ctx.message)}gend {msg.id}`",
                colour=discord.Color.blue(),
                timestamp=end)
            footerd(embed)
            embed.set_footer(
                text="Ends at",
                icon_url=
                'https://cdn.discordapp.com/avatars/785496485659148359/0fc85eb060bb37c35726fabe791170fe.webp?size=1024'
            )
            embed.set_author(
                name=str(prize),
                icon_url=
                "https://cdn.discordapp.com/attachments/743425064921464833/767981650070994984/86c9a4dde5bb348b53f2fb7ff099e9d5-square-wrapped-gift-box-by-vexels.png"
            )
            s = str(datetime.timedelta(seconds=time)).split(':')
            if s[0].startswith("0") and s[0].endswith("0"):
                if s[1].startswith("0"):
                    if s[2].startswith("0"):
                        yss = str(s[2])[1] + ' seconds'
                    else:
                        yss = s[2] + ' seconds'
                else:
                    yss = s[1] + ' minutes ' + s[2] + ' seconds'
            else:
                yss = s[0] + ' hours ' + s[1] + ' minutes ' + s[2] + ' seconds'
            ys = yss
            await msg.edit(
                content=
                "<:present:767981864132018176> **GIVEAWAY** <:present:767981864132018176>",
                embed=embed)
            await asyncio.sleep(3)
        while time != 1:
            time = time - 1
            embed = discord.Embed(
                description=
                f"🏅 Winners: {str(wnrs)}\n⌛ Time Remaining: **{ys}**\n🔰 Host: {ctx.author.mention}\nReact to 🎉 to enter the giveaway!\n\nIf the giveaway does not end automatically,\nuse `{prefix(ctx.message)}gend {msg.id}`",
                colour=discord.Color.blue(),
                timestamp=end)
            footerd(embed)
            embed.set_footer(
                text="Ends at",
                icon_url=
                'https://cdn.discordapp.com/avatars/785496485659148359/0fc85eb060bb37c35726fabe791170fe.webp?size=1024'
            )
            embed.set_author(
                name=str(prize),
                icon_url=
                "https://cdn.discordapp.com/attachments/743425064921464833/767981650070994984/86c9a4dde5bb348b53f2fb7ff099e9d5-square-wrapped-gift-box-by-vexels.png"
            )
            s = str(datetime.timedelta(seconds=time)).split(':')
            if s[0].startswith("0") and s[0].endswith("0"):
                if s[1].startswith("0"):
                    if s[2].startswith("0"):
                        yss = str(s[2])[1] + ' seconds'
                    else:
                        yss = s[2] + ' seconds'
                else:
                    yss = s[1] + ' minutes ' + s[2] + ' seconds'
            else:
                yss = s[0] + ' hours ' + s[1] + ' minutes ' + s[2] + ' seconds'
            ys = yss
            await msg.edit(
                content=
                "<:present:767981864132018176> **GIVEAWAY** <:present:767981864132018176>",
                embed=embed)
            await asyncio.sleep(1)
        await asyncio.sleep(2)
        e = Embed(
            description=
            f"🏅 Winners: {str(wnrs)}\n⌛ Time Remaining: **No Time!**\n🔰 Host: {ctx.author.mention}\nReact to 🎉 to enter the giveaway!\n\nIf the giveaway does not end automatically,\nuse `{prefix(ctx.message)}gend {msg.id}`",
            colour=Color.red(),
            timestamp=end)
        e.set_footer(
            text="Ends at",
            icon_url=
            'https://cdn.discordapp.com/avatars/785496485659148359/0fc85eb060bb37c35726fabe791170fe.webp?size=1024'
        )
        e.set_author(
            name=str(prize),
            icon_url=
            "https://cdn.discordapp.com/attachments/743425064921464833/767981650070994984/86c9a4dde5bb348b53f2fb7ff099e9d5-square-wrapped-gift-box-by-vexels.png"
        )
        footerd(e)
        await msg.edit(
            content=
            "<:present:767981864132018176> **GIVEAWAY** <:present:767981864132018176>",
            embed=e)
        await asyncio.sleep(3)
        msg2 = await channel.fetch_message(msg.id)
        users = await msg2.reactions[0].users().flatten()
        users.pop(users.index(self.bot.user))
        winners = []
        for i in range(win_amount):
            i = i
            winners.append(random.choice(users).mention)
        embed2 = discord.Embed(
            description=
            f"🔰 Host: {ctx.author.mention}\n🎟 Valid Entries: {len(users)}\n🏅 Winner(s): \n"
            + '\n'.join(winners) + "\n",
            colour=0x777777,
            timestamp=timei.now)
        footerd(embed2)
        embed2.set_footer(
            text="Ended at",
            icon_url=
            'https://cdn.discordapp.com/avatars/785496485659148359/0fc85eb060bb37c35726fabe791170fe.webp?size=1024'
        )
        if msg.content != "<:CH_present:767981864132018176> **GIVEAWAY ENDED** <:CH_present:767981864132018176>":
            await channel.send(
                f"🎊 **Congratulations** {', '.join(winners)}! You have won **{prize}**!"
            )
            await msg.edit(
                content=
                "<:present:767981864132018176> **GIVEAWAY ENDED** <:present:767981864132018176>",
                embed=embed2)
        else:
            pass
Example #20
0
 async def math_square_cmd(self, ctx, arg34_1: int, arg34_2: int):
     emb = discord.Embed(description=f'{mfmath.square(arg34_1, arg34_2)}',
                         color=emcolor)
     emb.set_author(name='Calculator', icon_url=ctx.author.avatar_url)
     footerd(emb)
     await ctx.channel.send(mfmath.square(arg34_1, arg34_2))
Example #21
0
 async def poll_cmd(self,
                    ctx,
                    title,
                    q1,
                    q2,
                    q3='-none',
                    q4='-none',
                    q5='-none',
                    q6='-none'):
     if q3 == '-none':
         emb0 = discord.Embed(
             title=title,
             description=
             f"\n\n1️⃣ {q1}\n2️⃣ {q2}\n\nPoll By: {ctx.author.mention}",
             colour=emcolor)
         emb0.set_thumbnail(url=ctx.author.avatar_url)
         emb0.set_footer(
             text=
             f"Requested By {ctx.author.name}#{ctx.author.discriminator}")
         msg0 = await ctx.channel.send(embed=emb0)
         await msg0.add_reaction('1️⃣')
         await msg0.add_reaction('2️⃣')
         return
     if q4 == '-none':
         emb0 = discord.Embed(
             title=title,
             description=
             f"\n\n1️⃣ {q1}\n2️⃣ {q2}\n3️⃣ {q3}\n\nPoll By: {ctx.author.mention}",
             colour=emcolor)
         emb0.set_thumbnail(url=ctx.author.avatar_url)
         footerd(emb0)
         msg0 = await ctx.channel.send(embed=emb0)
         await msg0.add_reaction('1️⃣')
         await msg0.add_reaction('2️⃣')
         await msg0.add_reaction('3️⃣')
         return
     if q5 == '-none':
         emb0 = discord.Embed(
             title=title,
             description=
             f"\n\n1️⃣ {q1}\n2️⃣ {q2}\n3️⃣ {q3}\n4️⃣ {q4}\n\nPoll By: {ctx.author.mention}",
             colour=emcolor)
         emb0.set_thumbnail(url=ctx.author.avatar_url)
         footerd(emb0)
         msg0 = await ctx.channel.send(embed=emb0)
         await msg0.add_reaction('1️⃣')
         await msg0.add_reaction('2️⃣')
         await msg0.add_reaction('3️⃣')
         await msg0.add_reaction('4️⃣')
         return
     if q6 == '-none':
         emb0 = discord.Embed(
             title=title,
             description=
             f"\n\n1️⃣ {q1}\n2️⃣ {q2}\n3️⃣ {q3}\n4️⃣ {q4}\n5️⃣ {q5}\n️\nPoll By: {ctx.author.mention}",
             colour=emcolor)
         emb0.set_thumbnail(url=ctx.author.avatar_url)
         footerd(emb0)
         msg0 = await ctx.channel.send(embed=emb0)
         await msg0.add_reaction('1️⃣')
         await msg0.add_reaction('2️⃣')
         await msg0.add_reaction('3️⃣')
         await msg0.add_reaction('4️⃣')
         await msg0.add_reaction('5️⃣')
         return
     emb0 = discord.Embed(
         title=title,
         description=
         f"\n\n1️⃣ {q1}\n2️⃣ {q2}\n3️⃣ {q3}\n4️⃣ {q4}\n5️⃣ {q5}\n️6️⃣ {q6}\n\nPoll By: {ctx.author.mention}",
         colour=emcolor)
     emb0.set_thumbnail(url=ctx.author.avatar_url)
     footerd(emb0)
     msg0 = await ctx.channel.send(embed=emb0)
     await msg0.add_reaction('1️⃣')
     await msg0.add_reaction('2️⃣')
     await msg0.add_reaction('3️⃣')
     await msg0.add_reaction('4️⃣')
     await msg0.add_reaction('5️⃣')
     await msg0.add_reaction('6️⃣')
     return