Beispiel #1
0
    async def newtodo(self, ctx, member: discord.Member = None):

        if member == None:

            await ctx.message.delete()
            return await ctx.author.send(embed=em(
                title="Uh oh!",
                description=
                "Uh oh, you forgot to supply an additional argument. Please make sure to supply a member.",
                colour=discord.Colour.red(),
                timestamp=datetime.utcnow()).set_thumbnail(
                    url=ctx.guild.icon_url).set_footer(
                        icon_url=self.bot.user.avatar_url,
                        text="IsThicc Management"))

        await ctx.message.delete()
        return await ctx.send(content=member.mention,
                              embed=em(
                                  title="IsThicc Management",
                                  description=f"""
Hey {member.mention}, you have new TODO's! Please make sure to review them - ``{ctx.prefix}todo view``
            """,
                                  colour=discord.Colour.green(),
                                  timestamp=datetime.utcnow()).set_thumbnail(
                                      url=ctx.guild.icon_url).set_footer(
                                          icon_url=self.bot.user.avatar_url,
                                          text="IsThicc Management"))
Beispiel #2
0
    async def accept(self, ctx, member: discord.Member):

        if member == None:

            await ctx.message.delete()
            return await ctx.author.send(embed=em(
                title="Uh oh!",
                description=
                "Uh oh, you forgot to supply an additional argument. Please make sure to supply a member.",
                colour=discord.Colour.red(),
                timestamp=datetime.utcnow()).set_thumbnail(
                    url=ctx.guild.icon_url).set_footer(
                        icon_url=self.bot.user.avatar_url,
                        text="IsThicc Management"))

        await ctx.message.delete()
        await ctx.send(
            content=member.mention,
            embed=em(
                title="Welcome to the team!",
                description=
                "Welcome to the IsThicc team! You will be on a one week trial period. During this one week period you will have almost all the same permissions as a normal staff member. At the end of the 1 week, the board will decide if your position will become permanent.\n_ _\nThank you for applying!\n**IsThicc Management**\n_ _",
                colour=discord.Colour.gold(),
                timestamp=datetime.utcnow()).set_thumbnail(
                    url=ctx.guild.icon_url).set_footer(
                        icon_url=self.bot.user.avatar_url,
                        text="IsThicc Management"))
Beispiel #3
0
    async def warn(self, ctx, member: discord.Member, *, reason = "No reason specified."):

        await ctx.send(embed=em(
            title="Warned!",
            description=f"I warned {member.mention} for {reason}!",
            colour=discord.Colour.green(),
            timestamp=datetime.utcnow()
        ).set_footer(
            icon_url=self.bot.user.avatar_url,
            text="IsThicc Moderation"
        ))
        try:
            await member.send(embed=em(
                title="You have been warned in IsThicc Software!",
                colour=discord.Colour.red(),
                timestamp=datetime.utcnow()
            ).set_footer(
                icon_url=self.bot.user.avatar_url,
                text="IsThicc Moderation"
            ))
        except:
            await ctx.author.send(embed=em(
                title=f"I was unable to send the warn message to {member}!",
                colour=discord.Colour.red(),
                timestamp=datetime.utcnow()
            ).set_footer(
                icon_url=self.bot.user.avatar_url,
                text="IsThicc Moderation"
            ))

        # warn_id = "".join(random.choice(string.ascii_letters + string.digits) for _ in range(15))
        warn_id = str(uuid4())
        await self.db.warn(ctx.author.id, reason, datetime.utcnow(), True, warn_id)
Beispiel #4
0
    async def warn(self,
                   ctx,
                   m: discord.Member = None,
                   reason: str = 'No reason specified.'):
        if m is None:
            return await ctx.reply(
                'You didnt specify a member! Usage:\n`warn <member> <reason>')

        _id = "".join(
            random.choice(string.ascii_letters + string.digits)
            for _ in range(15))

        await self.db.execute("INSERT INTO warnings VALUES('" + str(_id) +
                              "','" + str(m.id) + "')")
        e = em(
            description=
            f'I have warned {m.mention} for the reason **{reason}** with the warn id: `{_id}`',
            colour=Colour.teal(),
            timestamp=datetime.utcnow())
        await ctx.reply(embed=e)

        e2 = em(
            description=
            f'You got warned on **{ctx.guild}** by {ctx.author.mention} for the reason: **{reason}**\nWarn ID: `{_id}`',
            colour=Colour.red())
        await m.send(embed=e2)
Beispiel #5
0
    async def wireguard(self, ctx, member: Union[discord.Member] = None):

        if member is None:
            await ctx.message.delete()
            return await ctx.author.send(embed=em(
                title="Uh oh!",
                description=
                "Uh oh, you forgot to supply an additional argument. Please make sure to supply a member.",
                colour=discord.Colour.red(),
                timestamp=datetime.utcnow()).set_thumbnail(
                    url=ctx.guild.icon_url).set_footer(
                        icon_url=self.bot.user.avatar_url,
                        text="IsThicc Management"))

        return await ctx.send(content=member.mention,
                              embed=em(title="Wireguard!",
                                       description=f"""
Hey {member.mention}, IsThicc Management believe you are ready to get Wireguard access! Wireguard is a VPN client that we use to let staff use our internal services. 

Please follow the instructions in <#800601043346915369> to get ready. If you have any concerns or issues with this please let us know! Once you've made it to the end please wait for Management!
""",
                                       colour=discord.Colour.gold(),
                                       timestamp=datetime.utcnow()).set_footer(
                                           icon_url=self.bot.user.avatar_url,
                                           text="IsThicc Management"))
Beispiel #6
0
    async def todo_error(self, ctx, error):

        if isinstance(error, commands.MissingRole):
            await ctx.send(embed=em(
                title="Missing Permissions!",
                description="Sorry! This command is only for staff members!",
                colour=discord.Colour.red(),
                timestamp=datetime.utcnow()
            ).set_footer(
                icon_url=self.bot.user.avatar_url,
                text="IsThicc Staff"
            ))
        else:
            em_err = em(
                title="An error has occurred!",
                description=f"```css\n{str(error)}```",
                colour=discord.Colour.red(),
                timestamp=datetime.utcnow()
            )
            em_err.set_footer(
                icon_url=self.bot.user.avatar_url,
                text="IsThicc Staff"
            )

            if "msg" in locals():
                await locals()["msg"].edit(embed=em_err)
            else:
                await ctx.send(embed=em_err)
Beispiel #7
0
    async def status(self, ctx):
        # Progress Bar Settings
        length = len(urls)
        bars = 25

        pending = await ctx.send(embed=em(
            title="Fetching URL's",
            description=f"Please wait while IsThicc writes a status report...",
            colour=discord.Colour.green(),
            timestamp=datetime.utcnow()).set_footer(
                icon_url=self.bot.user.avatar_url, text="IsThicc Status"))
        status_em = em(
            title="Status Report",
            description=
            f"IsThicc software status report.\nWritten: {self.bot.gen_timestamp()}",
            colour=discord.Colour.green(),
            timestamp=datetime.utcnow()).set_footer(
                icon_url=self.bot.user.avatar_url, text="IsThicc Status"
            ).set_thumbnail(
                url='https://rebin.ch/wp-content/uploads/2015/09/icon-2.png'
            )  # TODO: Put this on our own CDN

        i = 0
        for title, url in urls.items():
            # Progress Bar
            i += 1
            p = int(bars * i / length)
            p_bar = f"┤{(p*'█ ')}{((bars-p)*'─')}├ **({i}/{length})**"
            await pending.edit(embed=em(
                title="Fetching URL's",
                description=
                f"Please wait while IsThicc writes a status report...\n{p_bar}",
                colour=discord.Colour.green(),
                timestamp=datetime.utcnow()).set_footer(
                    icon_url=self.bot.user.avatar_url, text="IsThicc Status"))

            # Getting Status
            request = await self.session.get(url)
            code = request.status

            # TODO: Change this to a dictionary, and use .get, not if's
            val = "unspecified"

            if code == 200: val = "is working"
            elif code == 401: val = "bad request"
            elif code == 403: val = "forbidden"
            elif code == 404: val = "not found"
            elif code == 500: val = "server internal error"

            sym = "✓" if code == 200 else "✗"
            status_em.add_field(name=f"{sym} {title}",
                                value=f"*[{title}]({url}) {val}. `{code}`*")

            request.close()

        await pending.edit(embed=status_em)
Beispiel #8
0
    async def unwarn(self, ctx, m: discord.Member = None, warnid: str = None):
        if m is None or warnid is None:
            return await ctx.reply('You didnt specify a member to unwarn! Usage:\n`unwarn <member> <warn id>`')
         
        await self.db.execute("DELETE FROM warnings WHERE warn_id = '" + warnid + "'")
        e = em(description=f'I have removed the warning **{warnid}** from {m.mention}.', colour=Colour.green())
        await ctx.reply(embed=e)

        e2 = em(description=f'Your warning by the id **{warnid}** got removed by {ctx.author.mention}!', colour=Colour.teal())
        await m.send(embed=e2)
Beispiel #9
0
    async def remind(self,
                     ctx,
                     option="development",
                     member: discord.Member = None):

        if option == None or member == None:

            await ctx.message.delete()
            return await ctx.author.send(embed=em(
                title="Uh oh!",
                description=
                "Uh oh, you forgot to supply an additional argument. Please make sure to supply a member and option.",
                colour=discord.Colour.red(),
                timestamp=datetime.utcnow()).set_thumbnail(
                    url=ctx.guild.icon_url).add_field(
                        name="Options:", value="```css\ndevelopment\n```"
                    ).set_footer(icon_url=self.bot.user.avatar_url,
                                 text="IsThicc Management"))

        if option.lower() == "development":

            await ctx.message.delete()
            return await ctx.send(
                content=member.mention,
                embed=em(title="IsThicc Management",
                         description=f"""
Hey {member.mention}, we noticed you haven't been making any progress. Please let us know how we can help you! If you cannot make any progress for any reason, make sure to let us know!

**This message has been sent based on Git commits.**
<#794454957440892930>
                """,
                         colour=discord.Colour.dark_red(),
                         timestamp=datetime.utcnow()).set_thumbnail(
                             url=ctx.guild.icon_url).set_footer(
                                 icon_url=self.bot.user.avatar_url,
                                 text="IsThicc Management"))

        else:

            await ctx.message.delete()
            return await ctx.author.send(embed=em(
                title="Uh oh!",
                description=
                "Uh oh, you gave an undefined argument! Please make sure to supply a valid member and option.",
                colour=discord.Colour.red(),
                timestamp=datetime.utcnow()).set_thumbnail(
                    url=ctx.guild.icon_url).add_field(
                        name="Options:", value="```css\ndevelopment\n```"
                    ).set_footer(icon_url=self.bot.user.avatar_url,
                                 text="IsThicc Management"))
Beispiel #10
0
    async def close(self, ctx):

        av = self.bot.user.avatar_url
        user = await self.db.execute(
            "SELECT user_id FROM tickets WHERE channel_id = " +
            str(ctx.channel.id))
        user = self.bot.get_user(user[0][0])
        try:
            await self.db.execute('SELECT 1 FROM tickets WHERE channel_id = ' +
                                  str(ctx.channel.id))
        except Exception:
            not_ticket = em(
                title="Sorry!",
                description=
                "Sorry! This channel isn't a ticket. Please use this command again in a ticket.",
                colour=discord.Colour.red(),
                timestamp=datetime.utcnow())
            not_ticket.set_footer(icon_url=av, text="IsThicc Tickets")
            return await ctx.send(embed=not_ticket)

        closing = em(title="Closing in 3 seconds!",
                     colour=discord.Colour.green(),
                     timestamp=datetime.utcnow())
        closing.set_footer(icon_url=av, text="IsThicc Tickets")

        await asyncio.sleep(3)

        await self.db.execute(
            'UPDATE tickets SET open = false WHERE channel_id = ' +
            str(ctx.channel.id))
        msg = await ctx.send(embed=closing)
        closed = discord.utils.get(ctx.guild.categories,
                                   id=tickets_archived_category_id)

        await ctx.channel.edit(
            name=f"Archived-{user.display_name}",
            topic=
            f"Ticket opened by {user.mention}. Closed by {ctx.author.mention}!",
            category=closed,
            reason="Ticket Closed.")

        # await ctx.channel.set_permissions(user, send_messages=True, read_messages=True)

        closed = em(title="Ticket closed!",
                    colour=discord.Colour.green(),
                    timestamp=datetime.utcnow())
        closed.set_footer(icon_url=av, text="IsThicc Tickets")
        await msg.edit(embed=closed)
Beispiel #11
0
    async def snipe(self, ctx):
        if ctx.channel.id not in self.snipe_cache.keys():
            return await ctx.send(embed=em(title='IsThicc | Error',
                                           description='Nothing to snipe!',
                                           colour=discord.Colour.red(),
                                           timestamp=datetime.utcnow()))
        msg = self.snipe_cache[ctx.channel.id]
        e = em(
            title='IsThicc | Snipe',
            colour=discord.Colour.blue(),
            description=f'{msg.author.mention} ({msg.author}):\n{msg.content}',
            timestamp=msg.created_at).set_footer(
                text='Sniped message sent at',
                icon_url=self.bot.user.avatar_url)

        await ctx.send(embed=e)
Beispiel #12
0
    async def updatetodo(self, ctx, member: Union[discord.Member, str] = None):

        if member is None:

            await ctx.message.delete()
            return await ctx.author.send(embed=em(
                title="Uh oh!",
                description=
                "Uh oh, you forgot to supply an additional argument. Please make sure to supply a member.",
                colour=discord.Colour.red(),
                timestamp=datetime.utcnow()).set_thumbnail(
                    url=ctx.guild.icon_url).set_footer(
                        icon_url=self.bot.user.avatar_url,
                        text="IsThicc Management"))

        if type(member) is not discord.Member:
            if member != "all":
                await ctx.message.delete()
                return await ctx.author.send(
                    "You inputted an incorrect argument! Please yell at Pie to finish this with an embed!"
                )

            staff_dict = {}
            for staff in ctx.guild.get_role(744012353808498808).members:
                staff_dict[staff.name.lower()] = staff

            #                               Staff development category
            for channel in self.bot.get_channel(812422468102520863).channels:
                if channel.name in staff_dict:
                    await self.update_todo_embed(staff_dict[channel.name],
                                                 channel, ctx)

        await ctx.message.delete()
        return await self.update_todo_embed(member, ctx.channel, ctx)
Beispiel #13
0
    async def on_message(self, message):

        if message.channel.id != 801929449124790353 or message.author.bot:
            return

        content = re.sub(r'~~|\|\||__|\*\*|`+', "", message.content)

        embed = em(colour=discord.Colour.blue(),
                   description=f"```{content}```").set_author(
                       name=f"New suggestion from {message.author}",
                       icon_url=message.author.avatar_url)

        if message.attachments:
            try:
                embed.set_image(url=attachment[0].url)
                if len(message.attachments) != 1:
                    embed.add_field(
                        "Attachments",
                        "\n".join(a.url for a in message.attachments))
            except Exception as e:
                await message.channel.send(e)

        msg = await self.bot.get_channel(801929480875802624).send(embed=embed)

        await msg.add_reaction('👍')
        await msg.add_reaction('👎')

        await message.reply(f'{msg.jump_url}',
                            delete_after=5,
                            mention_author=False)
        await message.delete()
Beispiel #14
0
    async def save_data(self, member, ctx):
        # update this to the real address
        app = open_projects[member.id]
        app_uri = f'http://10.42.10.4:5000/staff/project/{member.name}'

        # (the caps in the keys don't matter)
        title = app["answers"][0]
        data = {
            title: {
                "url": app["answers"][1],
                "vps": app["answers"][2],
                "sudo": app["answers"][3],
                "user": "******"
            }
        }

        await ctx.send(embed=em(title="Output",
                                url="https://isthicc.dev",
                                description=f"```{data[title]}```",
                                colour=discord.Colour.gold(),
                                timestamp=datetime.utcnow()).set_footer(
                                    icon_url=self.bot.user.avatar_url,
                                    text=f"IsThicc Management"))

        return

        data = json.dumps(data, separators=(',', ':'))
        headers = {"add": data}

        x = requests.post(app_uri, headers=headers)
        data = x.json()
        file = data["file"]

        print(f"Saved as file {file}")
Beispiel #15
0
    async def on_message(self, message):

        if message.channel.id != 801929449124790353 or message.author.bot:
            return

        # Remove Markdown Using Regex
        # **, ||, __, ~~ and `
        content = re.sub(r'~~|\|\||__|\*\*|`+', "", message.content)

        # Remove Markdown
        # content = ""
        # msg = message.content
        # for letter in msg:
        #     if letter == "`":
        #         continue
        #     elif letter in ['~', '_', "*", "|"]:
        #         if msg[msg.index(letter) + 1] == letter:  # check if **, __, or ~~
        #             continue
        #     else:
        #         content += letter

        msg = await self.bot.get_channel(801929480875802624).send(
            embed=em(colour=discord.Colour.blue(),
                     description=f"```{content}```").set_author(
                         name=f"New suggestion from {message.author}",
                         icon_url=message.author.avatar_url))

        await msg.add_reaction('👍')
        await msg.add_reaction('👎')

        await message.reply(f'{msg.jump_url}', delete_after=5, ping=False)
Beispiel #16
0
    async def decorator(ctx):
        try:
            await ctx.bot.db.execute(
                'SELECT 1 FROM tickets WHERE channel_id = ' +
                str(ctx.channel.id))
        except Exception:
            not_ticket = em(
                title="Sorry!",
                description=
                "Sorry! This channel isn't a ticket. Please use this command again in a ticket.",
                colour=discord.Colour.red(),
                timestamp=datetime.utcnow())
            not_ticket.set_footer(icon_url=ctx.author.avatar_url,
                                  text="IsThicc Tickets")
            return await ctx.send(embed=not_ticket)

        user = await ctx.bot.db.execute(
            "SELECT user_id FROM tickets WHERE channel_id = " +
            str(ctx.channel.id))
        user = ctx.bot.get_user(user[0][0])

        if ctx.author == user or ctx.guild.get_role(
                796953153010532362) in ctx.author.roles:
            return True
        raise InsufficientTicketPermissions()
Beispiel #17
0
    async def ask_question(self, id, ctx, question):
        app = open_projects[id]
        index = app["index"]
        title = f"{index}. " + question["title"]

        # send message
        await ctx.send(embed=em(title=question["title"],
                                url="https://isthicc.dev",
                                description=question["description"],
                                colour=discord.Colour.gold(),
                                timestamp=datetime.utcnow()).set_footer(
                                    icon_url=self.bot.user.avatar_url,
                                    text=f"You have 1 minute to answer"))

        app = open_projects[id]

        try:

            def wait_message(message):
                return not message.author.bot and message.author.id in open_projects and open_projects[
                    message.author.id]["channel_id"] == message.channel.id

            message = await self.bot.wait_for("on_message",
                                              check=wait_message,
                                              timeout=60)
        except asyncio.TimeoutError:
            return True

        index = open_projects[message.author.id]["index"]
        open_projects[message.author.id]["answers"][index].append(
            message.clean_content)

        return False
Beispiel #18
0
async def help_command(message):

    st = em(title='Можем сыграть',
            description='''
	 		Присутствуют следующие режимчики:

	 		1)квиз на 5 вопросиков - short - Default
	 		2)квиз на 10 вопросиков - long
	 		3)квиз на желаемое число вопросов - custom %желаемое количество вопросов%
	 		Запускаемся, значится, командой - /play 

	 		!Включить варианты - /variants ON 
	 		!Выключить варианты - /variants OFF
	 		!Default = False

	 		>За правильный ответ в игре без вариантов дается 3 балла
	 		>За правильный ответ в игре с вариантами дается 1 балл
	 		>За неправильный ответ в игре с вариантами забирается 2 балла


	 		Обкашлять вопросик дается 5 попыточек и 10 секунд

	 		$/score - показать баллы

	 		''',
            color=0xFF5733)
    return await message.channel.send(embed=st)
Beispiel #19
0
 async def _mode_not_found(self, message, content, sql_result):
     await message.channel.send(embed=self.bot.ef(
         em(title="Oh no, an error occurred!",
            description=
            "An error occurred while trying to find the correct Alphabet mode! "
            "This error can only be fixed by a member of management! Please alert them if it continues.",
            colour=discord.Colour.red()), "Alphabet"))
Beispiel #20
0
    async def _za_check(self, message, content, sql_result):
        if not (await self._check_user(message, sql_result[1])):
            return

        pos = self.alphabet.index(content)
        next_letter = (self.alphabet.index(sql_result[0]) - 1)
        next_letter = (next_letter if next_letter <=
                       (self.alphabet_len - 1) else 0)  # TODO: Test this logic

        if next_letter == 0 and content == "a":
            new_mode = await self._get_new_mode("Z_A")
            await self.bot.db.execute(
                "UPDATE Alphabet SET Letter = '{LETTER}', LastUser = {USER} WHERE ChannelID = {CHANNEL}, MODE = '{MODE}'"
                .format(LETTER=self.MODE_FIRST_LETTER.get(new_mode, "a"),
                        USER=message.author.id,
                        CHANNEL=self.alphabet_channel,
                        MODE=new_mode))
            return await message.channel.send(embed=self.bot.ef(
                em(title="Alphabet switch up!",
                   description=
                   "The alphabet mode has switched! Here is the description for this mode:\n\n"
                   f"{self.MODE_DESCRIPTIONS[new_mode]}",
                   colour=discord.Colour.teal()), "Alphabet"))

        if next_letter != pos:
            return await self.report_incorrect(message)

        await self.bot.db.execute(
            "UPDATE Alphabet SET Letter = '{LETTER}', LastUser = {USER} WHERE ChannelID = {CHANNEL}"
            .format(LETTER=self.alphabet[next_letter],
                    USER=message.author.id,
                    CHANNEL=self.alphabet_channel))
        await message.add_reaction(self.right_emoji)
Beispiel #21
0
    async def wait_for_answers(self, vars, message):
        time, id, channel = vars
        app = open_apps[id]

        try:

            def on_reaction(reaction, user):
                return (
                    str(reaction.emoji) == "✅" or str(reaction.emoji) == "❌"
                ) and not user.bot and app["message_id"] == reaction.message.id

            reaction, user = await self.bot.wait_for("reaction_add",
                                                     check=on_reaction,
                                                     timeout=time * 60)
        except asyncio.TimeoutError:
            return 2

        if str(reaction.emoji) == '❌':
            return 1
        # else: reacted with ✅

        if app["can_proceed"]:
            await message.clear_reactions()
            return 0

        await channel.send(embed=em(
            title="Invalid Answer",
            url="https://isthicc.dev",
            description=
            "No valid answers were detected, please answer the question and try again.",
            colour=discord.Colour.red(),
            timestamp=datetime.utcnow()).set_footer(
                icon_url=self.bot.user.avatar_url, text=f"IsThicc Management"))

        return await self.wait_for_answers(vars, message)
Beispiel #22
0
    async def ask_question(self, id, channel, question, change_title=True):
        # setup
        app = open_apps[id]
        index = app["index"]
        time = question["time"]
        title = f"{index}. " + question["title"]

        # send message
        msg = await channel.send(
            embed=em(title=(title if change_title else question["title"]),
                     url="https://isthicc.dev",
                     description=question["description"],
                     colour=discord.Colour.gold(),
                     timestamp=datetime.utcnow()).set_footer(
                         icon_url=self.bot.user.avatar_url,
                         text=f"You have {time} minute(s) to answer"))
        await msg.add_reaction('✅')
        await msg.add_reaction('❌')

        open_apps[id]["message_id"] = msg.id

        # await for reaction
        # messages are automatically collected
        # wait_for_answers() returns a 0-3 code
        return await self.wait_for_answers((time, id, channel), msg)
Beispiel #23
0
    async def write_aplication(self, ctx, member, category):
        channel = await ctx.guild.create_text_channel(
            f"app-result-{member.display_name}", category=category)
        await channel.set_permissions(ctx.guild.get_member(348547981253017610),
                                      send_messages=True,
                                      read_messages=True)

        app = open_apps[member.id]
        app_em = em(
            title=f"{member.name}#{member.discriminator} - Application",
            url="https://isthicc.dev",
            description="",
            colour=discord.Colour.green(),
            timestamp=datetime.utcnow()).set_footer(
                icon_url=self.bot.user.avatar_url, text="IsThicc Management")

        # add errythin to da embed
        for index in range(0, len(questions)):
            index += 1
            field = questions[index]["embed_field"]
            answerL = app["answers"][index]
            answer = ""
            for s in answerL:
                answer += f"{s}\n"

            if field == '': continue
            elif field[0] == '-':
                app_em.add_field(name=field[1:], value=answer, inline=True)
            else:
                app_em.description += f"{field}\n⬦ {answer}\n"

        # add the languages and their ratings to the embed
        answers = app["answers"]
        languages = answers[2][0].split(',')
        ratings = []
        for i in range(len(answers[2])):
            ratings.append(answers[len(questions) + i + 1])

        lang_value = ""

        for (i, language) in enumerate(languages):
            letter = re.search(r'\w', language)
            if letter:
                language = language.replace(letter[0], letter[0].upper())
            lang_value += f"{language} {ratings[i][0]}/10\n"

        app_em.add_field(name="Languages", value=lang_value, inline=True)

        # add final answer to the embed
        answer = ""
        for s in app["answers"][999]:
            answer += f"{s}\n"
        app_em.description += f'Why should they be accepted at IsThicc?\n⬦ {answer}'

        await channel.send(embed=app_em)

        await save_data(member)

        del open_apps[member.id]
Beispiel #24
0
 async def report_incorrect(self, message: discord.Message):
     await message.add_reaction(self.wrong_emoji)
     return await message.channel.send(embed=self.bot.ef(
         em(title="Wrong number!",
            description="You sent the wrong letter! Please try again.",
            timestamp=d.utcnow(),
            colour=discord.Colour.red()), "Alphabet"),
                                       delete_after=self.delete_after)
Beispiel #25
0
 async def api_member(self, ctx):
     return await ctx.send(embed=em(
         title="Oh no!",
         description=
         "Sorry! This command is currently only available for Staff members!",
         colour=discord.Colour.red(),
         timestamp=datetime.utcnow()).set_footer(
             icon_url=self.bot.user.avatar_url, text="IsThicc Management!"))
Beispiel #26
0
    async def api_management(self, ctx):

        request = await self.session.get("http://10.42.10.4:5000/endpoints")
        json = await request.json()

        if request.status != 200 or 'details' not in json:
            return await ctx.send(embed=em(
                title="An API Error has occurred!",
                description=
                f"Please check logs to figure out why a {request.status} has happened!",
                colour=discord.Colour.red(),
                timestamp=datetime.utcnow()).set_footer(
                    icon_url=self.bot.user.avatar_url,
                    text="IsThicc API Management"))

        msg = await ctx.send(embed=em(title="Processing request!",
                                      colour=discord.Colour.red(),
                                      timestamp=datetime.utcnow()).set_footer(
                                          icon_url=self.bot.user.avatar_url,
                                          text="IsThicc API Management"))

        r_em = em(
            title="Management API Urls!",
            description=
            "Below are the API endpoints available for Management, Staff and normal user use.",
            colour=discord.Colour.green(),
            timestamp=datetime.utcnow())

        if len(json['details']) <= 25:
            for endpoint in json['details']:
                r_em.add_field(name=endpoint['route'],
                               value=f"""
**Authorization:**
Admin: {endpoint['admin']}
Staff: {endpoint['staff']}

**Methods:**
``{"`` | ".join(endpoint['methods'])}``
                    """)

        else:
            for endpoint in json['details']:
                ...

        await msg.edit(embed=r_em)
Beispiel #27
0
 async def report_user(self, message: discord.Message):
     await message.add_reaction(self.wrong_emoji)
     return await message.channel.send(embed=self.bot.ef(
         em(title="Oh no!",
            description=
            "You sent the most recent letter! Please wait for someone else.",
            timestamp=d.utcnow(),
            colour=discord.Colour.red()), "Alphabet"),
                                       delete_after=self.delete_after)
Beispiel #28
0
    async def editsnipe(self, ctx):
        if ctx.channel.id not in self.editsnipe_cache.keys():
            return await ctx.send(embed=em(title='IsThicc | Error',
                                           description='Nothing to editsnipe!',
                                           colour=discord.Colour.red(),
                                           timestamp=datetime.utcnow()))
        b = self.editsnipe_cache[ctx.channel.id][0]
        a = self.editsnipe_cache[ctx.channel.id][1]
        e = em(
            title='IsThicc | Edit Snipe',
            colour=discord.Colour.blue(),
            description=
            f'{b.author.mention} ({b.author}):\n**Before:** {b.content}\n**After:** {a.content}',
            timestamp=b.created_at).set_footer(
                text='Edit snipe message sent at',
                icon_url=self.bot.user.avatar_url)

        await ctx.send(embed=e)
Beispiel #29
0
    async def archive(self, ctx):

        await ctx.message.delete()
        await ctx.send(embed=em(
            title="IsThicc Management will be archiving this channel shortly!",
            colour=discord.Colour.blue(),
            timestamp=datetime.utcnow()).set_thumbnail(url=ctx.guild.icon_url).
                       set_footer(icon_url=self.bot.user.avatar_url,
                                  text="IsThicc Management"))
Beispiel #30
0
    async def edit(self, ctx, member: discord.Member = None):

        return await ctx.send(embed=em(
            title="This option is under development!",
            colour=discord.Colour.red(),
            timestamp=datetime.utcnow()
        ).set_footer(
            icon_url=self.bot.user.avatar_url,
            text="IsThicc Staff"
        ))