Beispiel #1
0
 async def urban(self, ctx, message):
     """Gives the Urban Dictionary result of the given word"""
     if ctx.channel.is_nsfw():
         try:
             term = udtop(message)
             if term is None:
                 await ctx.send("No result was returned")
             else:
                 embed = discord.Embed(title=message + ":",
                                       colour=discord.Colour(0x2773cc),
                                       description=term.definition +
                                       "\n\n examples: \n" + term.example)
                 embed.set_footer(
                     text="powered by urbandictionary.com",
                     icon_url="https://i.imgur.com/RvNANOu.png")
                 await ctx.send(content="", embed=embed)
         except discord.Forbidden:
             await ctx.send(
                 "Bot appears to not have 'Embed Links' permission required for urban command. Please allow "
                 "dootdoot to embed links as it is required to send Rich Embeds"
             )
         except TimeoutError:
             await ctx.send(
                 "There was a timeout error. its possible that either host, discord api or Urban Dictionary have "
                 "curently issues. Please try again later and if issues continue contact bot owner."
             )
         except Exception:
             await ctx.send(
                 "There was an issue handling your request. Please try again later and if issues continue contact "
                 "bot owner.")
     else:
         await ctx.send(
             "Due to nature of Urban dictionary messages it is required to use this command in NSFW channel"
         )
Beispiel #2
0
def urban(keyword, ex=True):
    try:
        entry = udtop(keyword)
    except (TypeError, AttributeError, udtop.TermNotFound):
        result = "{} definition not found in urbandictionary.".format(keyword)
    else:
        result = "{} definition:\n".format(keyword)
        if ex:
            result += str(entry)
        else:
            result += entry.definition
    return result
Beispiel #3
0
 async def urban(self, ctx, message):
     """gives the urban result of the given word"""
     role = discord.utils.get(ctx.guild.roles, id=521388774375161861)
     if role in ctx.message.author.roles:
         #test = message        #also debug option
         #await ctx.send(test)  #debug option
         term = udtop(message)
         embed = discord.Embed(title=message + ":",
                               colour=discord.Colour(0x2773cc),
                               description=term.definition +
                               "\n\n examples: \n" + term.example)
         embed.set_footer(text="powered by urbandictionary.com",
                          icon_url="https://i.imgur.com/RvNANOu.png")
         await ctx.send(content="", embed=embed)
     else:
         await ctx.send(
             "This command is restricted to \"Pain Designers\" role or above"
         )
Beispiel #4
0
    async def ud(self, ctx, *word: str):
        term = " ".join(word)
        term_link = term.replace(" ", "%20")
        if term.upper() == "MAGGIE":
            embed = discord.Embed(title="Definition Page",
                                  url="https://goo.gl/j2DX9N",
                                  color=settings.embed_color)
            embed.set_author(name="Definition for Maggie",
                             url="https://goo.gl/j2DX9N")
            embed.add_field(
                name="Definition 📚",
                value="Girl with YUUUG milkers. Doesn't need a coat",
                inline=False)
            embed.add_field(
                name="Example 💬",
                value=
                "Maggie's got such big fun-fun milk bags, she doesn't need a coat! "
                "-Aidan Witkovsky 2018",
                inline=True)
            await ctx.message.channel.send(embed=embed)
        else:
            try:
                term_def = udtop(term)

                embed = discord.Embed(
                    title="Definition Page",
                    url="https://www.urbandictionary.com/define.php?term={}".
                    format(term_link),
                    color=settings.embed_color)
                embed.set_author(
                    name="Definition for {}".format(str(term).title()))
                embed.add_field(name="📚 Definition ",
                                value=term_def.definition[:1023],
                                inline=False)
                embed.add_field(name="💬 Example ",
                                value=term_def.example[:1023],
                                inline=True)
                await ctx.message.channel.send(embed=embed)
            except udtop.TermNotFound as error:
                await ctx.message.channel.send(
                    "ERROR: `{}`\n However, you can add your own here: "
                    "https://www.urbandictionary.com/add.php?word={}".format(
                        error, term_link))
Beispiel #5
0
async def on_message(message):

    user_id = message.author.id
    user_name = message.author

    user_add_karma(user_id, 1)
    print("GAVE 1 karma to {0} ({1}) for a message.".format(
        user_name, user_id))

    author_level = get_level(user_id)
    author_karma = get_karma(user_id)

    # Checks Karma / Level
    if author_karma > 100 * (author_level + 1):
        role_name = "Level {}".format(author_level + 1)
        level_role = discord.utils.get(message.server.roles, name=role_name)
        set_level(user_id, author_level + 1)
        await client.add_roles(user_name, level_role)
        await client.send_message(
            message.channel,
            "Congrats, <@{0}>! You're now level `{1}`.  :tada: ".format(
                user_id, author_level + 1))

    # Upvote Code
    if "HTTP" in message.content.upper():
        await client.add_reaction(message, upvote_emoji)

    # "Shut Up" code
    if shut_up_role in [role.id for role in message.author.roles]:
        await client.send_message(message.channel,
                                  "Shut up <@{}>".format(user_id))

    if "EAT MY ASS" in message.content.upper():
        await client.send_message(message.channel, "*With pleasure 😋*")

    # Ping Command
    if message.content.upper().startswith(".PING"):
        await client.send_message(message.channel, "Pong! :ping_pong:")

    # About Command
    if message.content.upper().startswith(".ABOUT"):
        embed = discord.Embed(title="Github",
                              url="https://github.com/Mehvix/synaps-bot",
                              color=0x0080c0)
        embed.set_author(name="About:",
                         url="https://steamcommunity.com/id/Mehvix/")
        embed.set_thumbnail(url="https://goo.gl/FCddaV")
        embed.add_field(name="Creator:", value="\u200b", inline=True)
        embed.add_field(name="Mehvix#7172", value="\u200b", inline=True)
        await client.send_message(message.channel, embed=embed)

    # Help Command
    if message.content.upper().startswith(".HELP"):
        embed = discord.Embed(title="Commands:", color=0x0080c0)
        embed.add_field(name=".help", value="This command.", inline=False)
        embed.add_field(name=".ping",
                        value="Play Ping-Pong with the bot.",
                        inline=False)
        embed.add_field(name=".uptime",
                        value="Returns however long the bot has been online.",
                        inline=False)
        embed.add_field(name=".8ball +question",
                        value="Returns the true answer to a question.",
                        inline=False)
        embed.add_field(name=".about",
                        value="Returns info on the bot.",
                        inline=False)
        embed.add_field(name=".karma",
                        value="Returns your karma amount.",
                        inline=False)
        embed.add_field(name=".karma @name",
                        value="Returns (name's) karma amount.",
                        inline=False)
        embed.add_field(name=".ud +word",
                        value="Returns (word) definition on Urban Dictionary.",
                        inline=False)
        embed.add_field(name=".serverrules (admin)",
                        value="Outputs the Server Rules.",
                        inline=False)
        await client.send_message(message.channel, embed=embed)

    # ".Accept" code
    role = discord.utils.get(message.server.roles, name=member_role_name)
    if member_role_id not in [role.id for role in message.author.roles]:
        if message.content.upper().startswith(".ACCEPT"):
            await client.add_roles(user_name, role)
            await client.delete_message(message)
            await client.send_message(
                discord.Object(id=notification_channel),
                "<@{}> is now a Member :ok_hand:".format(user_id))
        else:
            await client.delete_message(message)

    if ".UD" in message.content.upper():
        if verified_role_id in [role.id for role in message.author.roles]:
            # UD Code
            if message.content.upper().startswith(".UD"):
                if "MAGGIE" in message.content.upper():
                    embed = discord.Embed(title="Definition Page",
                                          url="https://goo.gl/j2DX9N",
                                          color=0x0080c0)
                    embed.set_author(name="Definition for Maggie",
                                     url="https://goo.gl/j2DX9N")
                    embed.set_footer(
                        text="Girl with YUUUG milkers. Doesnt need a coat")
                    await client.send_message(message.channel, embed=embed)
                else:
                    try:
                        target_def = message.content[4:]
                        term = udtop(target_def)
                        embed = discord.Embed(
                            title="Definition Page",
                            url=
                            "https://www.urbandictionary.com/define.php?term={}"
                            .format(target_def.replace(" ", "%20")),
                            color=0x0080c0)
                        embed.set_author(
                            name="Definition for " + target_def,
                            url=
                            "https://www.urbandictionary.com/define.php?term={}"
                            .format(target_def))
                        embed.set_footer(text=term)
                        await client.send_message(message.channel, embed=embed)
                    except AttributeError:
                        await client.send_message(
                            message.channel,
                            "Sorry, that word doesnt have a definition :( . "
                            "You can add your own here: ")
                        await client.send_message(
                            message.channel,
                            "https://www.urbandictionary.com/add.php?word={}".
                            format(target_def.replace(" ", "%20")))
        # If user isn't Verified
        else:
            if verified_role_id not in [
                    role.id for role in message.author.roles
            ]:
                await client.send_message(
                    message.channel,
                    "Sorry, <@{0}>. You have to be @{1} to use that command!".
                    format(user_id, verified_role_name))

    # Karma System
    if message.content.upper().startswith(".KARMA"):
        if verified_role_id in [role.id for role in message.author.roles]:
            if "!" in message.content[9:-1]:
                user_req = message.content[10:-1]
            else:
                user_req = message.content[9:-1]

            if message.content.upper()[7:] == "HELP":
                embed = discord.Embed(title="Karma Commands:", color=0x0080c0)
                embed.add_field(name=".karma",
                                value="Returns your karma amount.",
                                inline=False)
                embed.add_field(name=".karma (@name)",
                                value="Returns (name's) karma amount.",
                                inline=False)
                embed.add_field(
                    name="\u200b",
                    value=
                    "You get 5 karma for each upvote a link you post gets, and 1 for "
                    "each message you send.")
                await client.send_message(message.channel, embed=embed)
            elif message.content[7:] == "":
                await client.send_message(
                    message.channel, "You have `{}` karma.".format(
                        get_karma(message.author.id)))
            else:
                await client.send_message(
                    message.channel,
                    "<@{0}> has `{1}` karma.".format(user_req,
                                                     get_karma(user_req)))
        else:
            # If user isn't Verified
            if verified_role_id not in [
                    role.id for role in message.author.roles
            ]:
                await client.send_message(
                    message.channel,
                    "Sorry, <@{0}>. You have to be @{1} to use that command!".
                    format(user_id, verified_role_name))

    # Leveling
    if message.content.upper().startswith(".LEVEL"):
        if verified_role_id in [role.id for role in message.author.roles]:
            await client.send_message(message.channel,
                                      "You're level `{}`".format(author_level))
        else:
            # If user isn't Verified
            if verified_role_id not in [
                    role.id for role in message.author.roles
            ]:
                await client.send_message(
                    message.channel,
                    "Sorry, <@{0}>. You have to be @{1} to use that command!".
                    format(user_id, verified_role_name))

    # 8-Ball Code
    if message.content.upper().startswith(".8BALL"):
        if verified_role_id in [role.id for role in message.author.roles]:

            def get_answer(answer_number):
                if answer_number == 1:
                    return "It is certain"
                elif answer_number == 2:
                    return "It is decidedly so"
                elif answer_number == 3:
                    return "Yes"
                elif answer_number == 4:
                    return "Reply hazy try again"
                elif answer_number == 5:
                    return "Ask again later"
                elif answer_number == 6:
                    return "Concentrate and ask again"
                elif answer_number == 7:
                    return "My reply is **no**"
                elif answer_number == 8:
                    return "Outlook not so good"
                elif answer_number == 9:
                    return "Very doubtful"

            r = random.randint(1, 9)
            fortune = get_answer(r)
            await client.send_message(message.channel, fortune)
        else:
            if verified_role_id not in [
                    role.id for role in message.author.roles
            ]:
                await client.send_message(
                    message.channel,
                    "Sorry, <@{0}>. You have to be @{1} to use that command!".
                    format(user_id, verified_role_name))

    # Server Rules Command
    if admin_role_id in [role.id for role in message.author.roles]:
        if message.content.upper().startswith(".SERVERRULES"):
            await client.delete_message(message)
            embed = discord.Embed(
                title="Synaps Rules and Info",
                url="https://steamcommunity.com/groups/team_synaps",
                color=0x0080ff)
            embed.set_thumbnail(url="https://goo.gl/ibJU2z")
            embed.add_field(name="📜 Rules 1.)",
                            value="No spamming.",
                            inline=True)
            embed.add_field(name="👙 Rules 2.)",
                            value="No NSFW in Discussion.",
                            inline=True)
            embed.add_field(
                name="🎵 Rules 3.)",
                value="Please keep music requests in the music que channel.",
                inline=True)
            embed.add_field(
                name="🔰 Getting Verified:",
                value="Just add '[TS]' to your steam name and DM a Admin.",
                inline=True)
            embed.add_field(
                name="🔸 Getting Member:",
                value=
                "Read the rules above and type '.accept' in here. If for whatever reason it doesnt "
                "work, contact an Admin.",
                inline=True)
            await client.send_message(message.channel, embed=embed)
            await client.send_message(message.channel, "**Team Synaps Links**")
            await client.send_message(
                message.channel,
                "• http://steamcommunity.com/groups/team_synaps")
            await client.send_message(
                message.channel,
                "• https://socialclub.rockstargames.com/crew/team_synaps")
            await client.send_message(
                message.channel, "• https://blizzard.com/invite/XKp33F07e)")
    else:
        if admin_role_id not in [role.id for role in message.author.roles]:
            if message.content.upper().startswith(".SERVERRULES"):
                await client.send_message(
                    message.channel,
                    "Sorry, <@{}>. Only <@&{}>'s have permission to use this)".
                    format(user_id, admin_role_id))

    if message.content.upper().startswith(".UPTIME"):
        if days > .9:
            await client.send_message(
                message.channel,
                "The bot has been live for `{0}` day(s), `{1}` hours, `{1}` "
                "minute(s), and `{2}` second(s)! :clock1:".format(
                    days, hours, minutes, seconds))
        elif hours > .9:
            await client.send_message(
                message.channel,
                "The bot has been live for `{0}` hour(s), `{1}` minute(s), and `{2}` second(s)!"
                " :clock2:".format(hours, minutes, seconds))
        elif minutes > .9:
            await client.send_message(
                message.channel,
                "The bot has been live for `{0}` minutes, `{1}` seconds :clock4:"
                .format(minutes, seconds))
        else:
            await client.send_message(
                message.channel,
                "The bot has been live for `{0}` second(s) :clock3:".format(
                    seconds))

    if message.content.startswith(
            "This is an automated message to spawn Pokémon."):
        await client.delete_message(message)

    # Gets random bear picture
    if message.content.upper().startswith(".BEAR"):
        if message.channel == notification_channel:
            if verified_role_id in [role.id for role in message.author.roles]:
                fp = random.choice(os.listdir("bears"))
                await client.send_file(message.channel, "bears/{}".format(fp))
            else:
                if verified_role_id not in [
                        role.id for role in message.author.roles
                ]:
                    await client.send_message(
                        message.channel,
                        "Sorry, <@{0}>. You have to be @{1} to use that command."
                        .format(user_id, verified_role_name))
        else:
            await client.send_message(
                message.channel,
                "Sorry, that command is banned in <#{}> :disappointed_relieved: "
                .format(notification_channel))
Beispiel #6
0
async def on_message(message):
    user_id = message.author.id
    user_name = message.author

    user_add_karma(user_id, 1)
    print("GAVE 1 karma to {0} ({1}) for a message.".format(
        message.author, user_id))

    # ".accept" code
    role = discord.utils.get(message.server.roles, name=member_name)

    if member_role not in [role.id for role in message.author.roles]:
        if message.content.upper().startswith(".ACCEPT"):
            await client.add_roles(message.author, role)
            await client.delete_message(message)
            await client.send_message(
                discord.Object(id=notification_channel),
                "<@{}> is now a Member :ok_hand:".format(user_id))
        else:
            await client.delete_message(message)

    # Karma System (BETA)
    elif message.content.upper().startswith(".KARMA"):
        if "!" in message.content[9:-1]:
            user_req = message.content[10:-1]
        else:
            user_req = message.content[9:-1]

        if message.content.upper()[7:] == "HELP":
            embed = discord.Embed(title="Karma Commands:", color=0x0080c0)
            embed.add_field(name=".karma",
                            value="Returns your karma amount.",
                            inline=False)
            embed.add_field(name=".karma @name",
                            value="Returns (name"
                            "s) karma amount.",
                            inline=False)
            embed.add_field(
                name="\u200b",
                value=
                "You get 5 karma for each upvote a link you post gets, and 1 for each"
                " message you send")
            await client.send_message(message.channel, embed=embed)
        elif message.content[7:] == "":
            await client.send_message(
                message.channel,
                "You have `{}` karma.".format(get_karma(user_id)))
        else:
            await client.send_message(
                message.channel,
                "<@{0}> has `{1}` karma.".format(user_req,
                                                 get_karma(user_req)))

    # UD Code
    elif message.content.upper().startswith(".UD"):
        target_def = message.content[4:]
        term = udtop(target_def)

        try:
            embed = discord.Embed(
                title="Definition Page",
                url="https://www.urbandictionary.com/define.php?term={}".
                format(target_def),
                color=0x0080c0)
            embed.set_author(name="Definition for " + target_def,
                             url="https://www.urbandictionary.com/define.php?"
                             "term={}".format(target_def))
            embed.set_footer(text=term)
            await client.send_message(message.channel, embed=embed)
        except AttributeError:
            await client.send_message(
                message.channel,
                "Sorry, `{0}` has no definition! You can add your own definition"
                " at https://www.urbandictionary.com/add.php?word={1}".format(
                    target_def, target_def))

    # "Shut Up" code
    elif shut_up_role in [role.id for role in message.author.roles]:
        await client.send_message(message.channel,
                                  "Shut up <@{}>".format(user_id))

    # Upvote Code
    elif "HTTP" in message.content.upper():
        await client.add_reaction(message, upvote_emoji)

    # 8-Ball Code
    elif message.content.upper().startswith(".8BALL"):

        def get_answer(answer_number):
            if answer_number == 1:
                return "It is certain"
            elif answer_number == 2:
                return "It is decidedly so"
            elif answer_number == 3:
                return "Yes"
            elif answer_number == 4:
                return "Reply hazy try again"
            elif answer_number == 5:
                return "Ask again later"
            elif answer_number == 6:
                return "Concentrate and ask again"
            elif answer_number == 7:
                return "My reply is no"
            elif answer_number == 8:
                return "Outlook not so good"
            elif answer_number == 9:
                return "Very doubtful"

        r = random.randint(1, 9)
        fortune = get_answer(r)
        await client.send_message(message.channel, fortune)

    elif message.content.upper().startswith(".PING"):
        await client.send_message(message.channel, "Pong! :ping_pong:")

    elif message.content.upper().startswith(".ABOUT"):
        embed = discord.Embed(title="Github",
                              url="https://github.com/Mehvix/synaps-bot",
                              color=0x0080c0)
        embed.set_author(name="About:",
                         url="https://steamcommunity.com/id/Mehvix/")
        embed.set_thumbnail(url="https://goo.gl/FCddaV")
        embed.add_field(name="Creator:", value="\u200b", inline=True)
        embed.add_field(name="Mehvix#7172", value="\u200b", inline=True)
        await client.send_message(message.channel, embed=embed)

    elif message.content.upper().startswith(".HELP"):
        embed = discord.Embed(title="Commands:", color=0x0080c0)
        embed.add_field(name=".uptime",
                        value="Returns however long the bot has been online.",
                        inline=False)
        embed.add_field(name=".8ball +question",
                        value="Returns the true answer to a question.",
                        inline=False)
        embed.add_field(name=".about",
                        value="Returns info on the bot.",
                        inline=False)
        embed.add_field(name=".karma",
                        value="Returns your karma amount.",
                        inline=False)
        embed.add_field(name=".karma @name",
                        value="Returns (name"
                        "s) karma amount.",
                        inline=False)
        embed.add_field(name=".ud +word",
                        value="Returns (word) definition on Urban Dictionary.",
                        inline=False)
        await client.send_message(message.channel, embed=embed)

    elif message.content.upper().startswith(".UPTIME"):
        if hours > .9:
            await client.send_message(
                message.channel,
                "The bot has been live for `{0}` hour(s), `{1}` minute(s), and `{2}` second(s)!"
                " :clock2:".format(hours, minutes, seconds))
        elif minutes > .9:
            await client.send_message(
                message.channel,
                "The bot has been live for `{0}` minutes, `{1}` seconds :clock4:"
                .format(minutes, seconds))
        else:
            await client.send_message(
                message.channel,
                "The bot has been live for `{0}` second(s) :clock3:".format(
                    seconds))
Beispiel #7
0
    async def on_message(self, message):
        # Message author variables
        user_id = message.author.id
        user_name = message.author

        author_level = karma.get_level(user_id)
        author_karma = karma.get_karma(user_id)

        if message.server and message.author.roles:
            if settings.verified_role_id in [role.id for role in message.author.roles]:
                # UD Code
                if message.content.upper().startswith(".UD"):
                    target_def = message.content[4:]
                    target_def_link_format = target_def.replace(" ", "%20")

                    if "MAGGIE" in message.content.upper():  # Hey don't worry about these couple of lines
                        print("{0}: {1}  requested the UD for Maggie".format(curtime.get_time(), user_name))
                        embed = discord.Embed(title="Definition Page", url="https://goo.gl/j2DX9N", color=settings.embed_color)
                        embed.set_author(name="Definition for Maggie", url="https://goo.gl/j2DX9N")
                        embed.add_field(name="Definition 📚", value="Girl with YUUUG milkers. Doesnt need a coat",
                                        inline=False)
                        embed.add_field(name="Example 💬",
                                        value="Maggie's got such big fun-fun milk bags, she doesn't need a coat! "
                                              "-Aidan Witkovsky 2018",
                                        inline=True)
                        await self.client.send_message(message.channel, embed=embed)
                    else:
                        try:
                            term = udtop(target_def)
                            print("{0}: {1} requested the UD for {2}".format(curtime.get_time(), user_name, target_def))
                            embed = discord.Embed(title="Definition Page", color=settings.embed_color)
                            embed.set_author(name="Definition for {}".format(string.capwords(target_def)))
                            embed.add_field(name="Definition 📚", value=term.definition[:1024], inline=False)
                            embed.add_field(name="Example 💬", value=term.example[:1024], inline=True)
                            await self.client.send_message(message.channel, embed=embed)
                        except (IndexError, AttributeError) as error:
                            await self.client.send_message(message.channel,
                                                           "ERROR `{}`\nSorry, that word doesn't have a definition :( "
                                                           ". You can add your own here: ".format(error))
                            await self.client.send_message(
                                message.channel,
                                "https://www.urbandictionary.com/add.php?word=" + target_def_link_format)

                # 8Ball Code
                if message.content.upper().startswith(".ZALGO "):
                    target = message.content[7:]
                    intensity = {"up": 10, "mid": 10, "down": 10}
                    await self.client.send_message(message.channel, zalgo.zalgo(target, intensity))

                # 8Ball Code
                if message.content.upper().startswith(".8BALL"):
                    print("{0}: {1} requested '.8BALL'".format(curtime.get_time(), user_name))

                    def get_answer(answer_number):
                        if answer_number == 1:
                            return "It is certain"
                        elif answer_number == 2:
                            return "It is decidedly so"
                        elif answer_number == 3:
                            return "Yes"
                        elif answer_number == 4:
                            return "Reply hazy try again"
                        elif answer_number == 5:
                            return "Ask again later"
                        elif answer_number == 6:
                            return "Concentrate and ask again"
                        elif answer_number == 7:
                            return "My reply is **no**"
                        elif answer_number == 8:
                            return "Outlook not so good"
                        elif answer_number == 9:
                            return "Very doubtful"

                    r = random.randint(1, 9)
                    fortune = get_answer(r)
                    await self.client.send_message(message.channel, fortune)

                # Uptime Code
                if message.content.upper().startswith(".UPTIME"):
                    print("{0}: {1} requested '.UPTIME'".format(curtime.get_time(), user_name))

                    await self.client.send_message(message.channel, "The bot has been live for `{}` {}".format(
                        curtime.uptime(), random.choice(clock_emoji)))

                # Gets random bear picture
                if message.content.upper().startswith(".BEAR"):
                    print("{0}: {1} sent a bear".format(curtime.get_time(), user_name))
                    fp = random.choice(os.listdir("media/bears"))
                    await self.client.send_file(message.channel, "media/bears/{}".format(fp))

                # Gets random Sam picture
                if message.content.upper().startswith(".SAM"):
                    print("{0}: {1} sent a sam".format(curtime.get_time(), user_name))
                    fp = random.choice(os.listdir("media/sams"))
                    await self.client.send_file(message.channel, "media/sams/{}".format(fp))

                # Gets random Apu picture
                if message.content.upper().startswith(".APU"):
                    print("{0}: {1} sent a apu".format(curtime.get_time(), user_name))
                    fp = random.choice(os.listdir("media/apus"))
                    await self.client.send_file(message.channel, "media/apus/{}".format(fp))

                if message.content.upper() == ".CAT":
                    search = "https://nekos.life/api/v2/img/meow"
                    async with self.session.get(search) as r:
                        result = await r.json()
                    await self.client.send_message(message.channel, result['url'])

                if message.content.upper() == ".DOG":
                    search = "https://dog.ceo/api/breeds/image/random"
                    async with self.session.get(search) as r:
                        result = await r.json()
                    await self.client.send_message(message.channel, result['message'])

                # Server Info
                if message.content.upper().startswith(".SERVERINFO"):
                    print("{0}: {1} requested '.SERVER'".format(curtime.get_time(), user_name))
                    online = 0
                    for i in message.server.members:
                        if str(i.status) == "online" or str(i.status) == "idle" or str(i.status) == "dnd":
                            online += 1

                    role_count = len(message.server.roles)
                    emoji_count = len(message.server.emojis)
                    server_created_time = message.server.created_at

                    print("{0}: {1} activated the SERVER command".format(curtime.get_time(), user_name))
                    em = discord.Embed(color=settings.embed_color)
                    em.set_author(name="Server Info:")
                    em.add_field(name="Server Name:", value=message.server.name)
                    em.add_field(name="Server ID:", value=message.server.id)
                    em.add_field(name="Owner:", value=message.server.owner, inline=False)
                    em.add_field(name="Members:", value=message.server.member_count)
                    em.add_field(name="Members Online:", value=online)
                    # em.add_field(name="Text Channels", value=str(channel_count))
                    em.add_field(name="Region:", value=message.server.region)
                    em.add_field(name="Verification Level:", value=str(message.server.verification_level).capitalize())
                    em.add_field(name="Highest Ranking Role:", value=message.server.role_hierarchy[0])
                    em.add_field(name="Number of Roles:", value=str(role_count))
                    em.add_field(name="Custom Emotes:", value=str(emoji_count))
                    em.add_field(name="Time Created:", value=str(server_created_time)[:10])
                    em.add_field(name="Default Channel:", value=message.server.default_channel)
                    em.add_field(name="AFK Time:", value="{} seconds".format(message.server.afk_timeout))
                    em.add_field(name="AFK Channel:", value=message.server.afk_channel)
                    em.add_field(name="Voice Client:", value=message.server.voice_client)
                    em.add_field(name="Icon URL", value=message.server.icon_url)
                    em.set_thumbnail(url=message.server.icon_url)
                    em.set_author(name="\u200b")
                    await self.client.send_message(message.channel, embed=em)

                # TODO Fix this
                # Gives Server Emojis
                if message.content.upper().startswith(".EMOTES"):
                    print("{0}: {1} activated the EMOTES command".format(curtime.get_time(), user_name))
                    emojis = [str(x) for x in message.server.emojis]
                    emojis_str = "> <".join(emojis)
                    await self.client.send_message(message.channel, emojis_str)

                    # Gives link to beta testing server
                if message.content.upper().startswith(".BETA"):
                    print("{0}: {1} activated the BETA command".format(curtime.get_time(), user_name))
                    user = await self.client.get_user_info(user_id)
                    await self.client.send_message(message.channel,
                                                   "Hey <@!196355904503939073>, <@{}> wants beta access.\nType"
                                                   " `.allow` to send them an invite".format(user_id))
                    msg = await self.client.wait_for_message(content=".allow")
                    if msg is None:
                        await self.client.send_message(
                            message.channel,
                            "<@!196355904503939073> didn't respond in time :(. Please try another time.")
                    else:
                        if msg.author.id == "196355904503939073":  # My Discord ID
                            testinvite = settings.get_json('./test_server.json')
                            invite = testinvite.get("invite")
                            await self.client.send_message(user, "You've been accepted! {}".format(invite))
                            await self.client.send_message(message.channel,
                                                           "<@{}> was accepted into the beta testing server! "
                                                           ":tada:".format(user_id))
                        else:
                            await self.client.send_message(message.channel, "You can't do that!")

                if message.content.upper().startswith(".DMME"):
                    user = await self.client.get_user_info(user_id)
                    await self.client.send_message(user, "DM")

                if message.content.upper().startswith(".COPYPASTA"):
                    c = 0
                    while c != 1:
                        search = "https://www.reddit.com/r/copypasta/random/.json?limit=1"
                        async with self.session.get("{}?limit=1".format(search)) as r:
                            result = await r.json()
                        if result[0]['data']['children'][0]['data']['author'] == "AutoModerator" or result[0]['data']['children'][0]['data']['pinned'] == "false":
                            print("Post was automodpost, skipping")
                            pass
                        else:
                            c = 1

                    embed = discord.Embed(
                        title=str(result[0]['data']['children'][0]['data']['title'])[:256],
                        color=settings.embed_color, description="[View Post]({})\n {}".format(
                            str(result[0]['data']['children'][0]['data']['url']),
                            str(result[0]['data']['children'][0]['data']['selftext'])[:1800]))

                    if '.redd.it' or 'imgur' in result[0]['data']['children'][0]['data']['url']:
                        embed.set_image(url=result[0]['data']['children'][0]['data']['url'])

                    if len(result[0]['data']['children'][0]['data']['selftext']) > 1800:
                        embed.set_footer(text="This post was too long to fit. Full version can be found via the 'View "
                                              "Post' button above")

                    await self.client.send_message(message.channel, embed=embed)

                if message.content.upper().startswith(".EMOJIPASTA"):
                    c = 0
                    while c != 1:
                        search = "https://www.reddit.com/r/emojipasta/random/.json?limit=1"
                        async with self.session.get("{}?limit=1".format(search)) as r:
                            result = await r.json()
                        if result[0]['data']['children'][0]['data']['author'] == "AutoModerator" or result[0]['data']['children'][0]['data']['pinned'] == "false":
                            print("Post was automodpost, skipping")
                            pass
                        else:
                            c = 1

                    embed = discord.Embed(
                        title=str(result[0]['data']['children'][0]['data']['title'])[:256],
                        color=settings.embed_color, description="[View Post]({})\n {}".format(
                            str(result[0]['data']['children'][0]['data']['url']),
                            str(result[0]['data']['children'][0]['data']['selftext'])[:1800]))

                    try:
                        # if '.redd.it' or 'imgur' in result[0]['data']['children'][0]['data']['url']:
                        embed.set_image(url=result[0]['data']['children'][0]['data']['url'])
                    except:
                        pass

                    if len(result[0]['data']['children'][0]['data']['selftext']) > 1800:
                        embed.set_footer(text="This post was too long to fit. Full version can be found via the 'View "
                                              "Post' button above")

                    await self.client.send_message(message.channel, embed=embed)

                # Who-is command
                # Assistance from https://gist.github.com/Grewoss/c0601832982a99f59cc73510f7841fe4
                if message.content.upper().startswith(".WHOIS"):
                    print("{0}: {1} requested '.WHOIS'".format(curtime.get_time(), user_name))
                    try:
                        user = message.mentions[0]
                    except IndexError:
                        await self.client.send_message(message.channel, "You `@` a role, not a user!")
                    full_user_name = "{}#{}".format(user.name, user.discriminator)
                    if message.content[7:] is None:
                        await self.client.send_message(message.channel, "You forgot to '@' a user!")
                    else:
                        try:
                            user_join_date = str(user.joined_at).split('.', 1)[0]
                            user_created_at_date = str(user.created_at).split('.', 1)[0]
                            avatar = user.avatar_url if user.avatar else user.default_avatar_url

                            embed = discord.Embed(color=settings.embed_color)
                            embed.set_author(name="User Info")
                            embed.add_field(name="Username:"******"User ID:", value=user.id)
                            embed.add_field(name="Joined the server on:", value=user_join_date[:10])
                            embed.add_field(name="User Created on:", value=user_created_at_date[:10])
                            embed.add_field(name="User Status:", value=str(user.status).title())
                            embed.add_field(name="User Game:", value=user.game)
                            embed.add_field(name="User Custom Name:", value=user.nick)
                            embed.add_field(name="User Role Color:", value=user.color)
                            if len(user.roles) > 1:  # TIL @everyone is a role that is assigned to everyone but hidden
                                embed.add_field(name="User Top Role (Level):", value=user.top_role)
                            else:
                                embed.add_field(name="User Top Role (Level):", value="User has no roles")
                            embed.add_field(name="User Avatar URL", value=avatar)
                            embed.set_thumbnail(url=user.avatar_url)
                            await self.client.send_message(message.channel, embed=embed)
                        except (IndexError, AttributeError):
                            print("{0}: {1} requested '.WHOIS' but they DIDN'T exist".format(curtime.get_time(),
                                                                                             user_name))
                            await self.client.send_message(message.channel, "Sorry, but I couldn't find that user")

                if message.content.upper().startswith(".BANLIST"):
                    ban_list = await self.client.get_bans(message.server)
                    if not ban_list:
                        await self.client.send_message(message.channel, "This server doesn't have anyone banned (yet)")
                    else:
                        userid = [user.id for user in ban_list]
                        name = [user.name for user in ban_list]
                        discriminator = [user.discriminator for user in ban_list]
                        bot = [user.bot for user in ban_list]

                        newlist = []
                        for item in bot:
                            if item:
                                item = "<:bottag:473742770671058964>"
                            else:
                                item = ""
                            newlist.append(item)
                        bot = newlist

                        total = list((zip(userid, name, discriminator, bot)))

                        # Thanks to happypetsy on stackoverflow for helping me with this!
                        pretty_list = set()
                        for details in total:
                            data = "•<@{}>{} ({}#{}) ".format(details[0], details[3], details[1], details[2])
                            pretty_list.add(data)

                        await self.client.send_message(message.channel,
                                                       "**Ban list:** \n{}".format("\n".join(pretty_list)))

                # Create an Invite
                if message.content.upper().startswith(".CREATEINVITE"):
                    invite = await self.client.create_invite(destination=message.channel, max_age=0, temporary=False,
                                                             unique=True)
                    await self.client.send_message(message.channel, invite)

                if message.content.upper().startswith(".INVITE"):
                    if not message.raw_mentions:
                        await self.client.send_message(message.channel, 'You need to `@` a user (maybe you meant '
                                                                        '`.createinvite` :thinking:')
                    else:
                        invite_target = message.raw_mentions[0]
                        user = await self.client.get_user_info(invite_target)
                        invite = await self.client.create_invite(destination=message.channel, max_age=0,
                                                                 temporary=False,
                                                                 unique=True)
                        try:
                            await self.client.send_message(
                                user, "<@{}> ({}) wants to invite  you to `{}`. You can join with this link: {}".format(
                                    message.author.id, message.author.name, message.server.name, invite))
                        except discord.Forbidden:
                            await self.client.send_message(message.channel, "Sorry, but I cannot send a message to "
                                                                            "that user due to there privacy settings "
                                                                            ":(")
                # Roulette system
                if message.content.upper().startswith(".ROULETTE"):
                    if message.content.upper().startswith(".ROULETTE HELP"):
                        print("{0}: {1} requested roulette help")
                        embed = discord.Embed(title="Outcomes:", color=settings.embed_color)
                        embed.set_author(name="Roulette Help")
                        embed.set_thumbnail(url="https://d30y9cdsu7xlg0.cloudfront.net/png/90386-200.png")
                        embed.add_field(name="Zero:", value="0", inline=True)
                        embed.add_field(name="Even:",
                                        value="2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36",
                                        inline=True)
                        embed.add_field(name="Odd:",
                                        value="1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35",
                                        inline=True)
                        embed.add_field(name="How to Play:",
                                        value="Just type '.roulette'",
                                        inline=True)
                        embed.set_footer(
                            text="Maximum bet is 250 karma. Winning on zero will quattuordecuple (x14) your "
                                 "bet while odd and even will double your bet")
                        await self.client.send_message(message.channel, embed=embed)
                        return None
                    if message.content.upper().startswith(".ROULETTE OUTCOMES"):
                        with open('C:/Users/maxla/PycharmProjects/synapsBot remastered/roulette_outcomes.json',
                                  'r') as fp:
                            outcomes = json.load(fp)
                        odd_total = outcomes['odd']
                        even_total = outcomes['even']
                        zero_total = outcomes['zero']
                        total_total = outcomes['total']

                        outcomes_list = [odd_total, even_total, zero_total]
                        total = sum(outcomes_list)
                        embed = discord.Embed(title="\u200b", color=settings.embed_color)
                        embed.set_author(name="Roulette Outcomes 📊")
                        embed.add_field(name="Total number of times 'spun'", value=total, inline=True)
                        embed.add_field(name="Total Bet", value=total_total, inline=False)
                        embed.add_field(name="Odd", value=odd_total, inline=True)
                        embed.add_field(name="Even", value=even_total, inline=True)
                        embed.add_field(name="Zero", value=zero_total, inline=True)
                        await self.client.send_message(message.channel, embed=embed)
                        return None
                    else:
                        await self.client.send_message(
                            message.channel,
                            "How much would you like to bet? It must be between `10` and `250` and cannot be "
                            "more than your karma (`{}`)".format(karma.get_karma(user_id)))
                        bet_amount_message = await self.client.wait_for_message(
                            timeout=120, author=message.author, channel=message.channel)
                        try:
                            bet_amount = int(bet_amount_message.content)
                            print("{0}: Bet {1}".format(curtime.get_time(), bet_amount))
                        except ValueError:
                            await self.client.send_message(
                                message.channel, "Sorry, you need to bet a number between `10` and `250`")
                            return
                        except IndexError:
                            await self.client.send_message(
                                message.channel, "Sorry, you need to bet a number between `10` and `250`")
                            return

                        if 10 <= bet_amount <= 250:
                            if bet_amount > author_karma:
                                await self.client.send_message(
                                    message.channel, "You don't have enough karma! You must bet under `{}`".format(
                                        karma.get_karma(user_id)))
                                return

                            with open('C:/Users/maxla/PycharmProjects/synapsBot remastered/roulette_outcomes.json',
                                      'r') as fp:
                                outcomes = json.load(fp)
                            outcomes['total'] += bet_amount
                            with open('C:/Users/maxla/PycharmProjects/synapsBot remastered/roulette_outcomes.json',
                                      'w') as fp:
                                json.dump(outcomes, fp, sort_keys=True, indent=4)

                            outcomes = ["zero", "even", "odd"]
                            await self.client.send_message(
                                message.channel,
                                "What outcome would you like to bet on? The options are `zero`, `even`, or "
                                "`odd`")
                            outcomes_response = await self.client.wait_for_message(
                                timeout=120, author=message.author, channel=message.channel)

                            try:
                                outcomes_formatted = outcomes_response.content
                                outcomes_formatted = outcomes_formatted.lower()
                                print("{0}: Outcome set to {1}".format(curtime.get_time(), outcomes_formatted))
                            except AttributeError:
                                await self.client.send_message(
                                    message.channel,
                                    "<@{}> DIDN'T respond fast enough, so the roulette was canceled".format(
                                        message.author.id))
                                return

                            if outcomes_formatted in outcomes:
                                print("{0}: Outcome set to {1}".format(curtime.get_time(), outcomes_formatted))
                                karma.user_add_karma(user_id, -int(bet_amount))
                                print("{0}: subtracted {1} karma for bet".format(curtime.get_time(), -int(bet_amount)))
                                rolling_message = await self.client.send_message(message.channel, "Spinning")
                                await asyncio.sleep(.25)
                                await self.client.edit_message(rolling_message, "Spinning.")
                                await asyncio.sleep(.25)
                                await self.client.edit_message(rolling_message, "Spinning..")
                                await asyncio.sleep(.25)
                                await self.client.edit_message(rolling_message, "Spinning...")
                                await asyncio.sleep(.25)
                                await self.client.delete_message(rolling_message)

                                spin = random.randint(0, 36)
                                print("{0}: Landed on {1}".format(curtime.get_time(), spin))
                                msg = await self.client.send_message(message.channel, "It landed on `{}`!".format(spin))
                                if msg.content == "It landed on `0`!":
                                    await self.client.pin_message(msg)
                                    david_dm = await self.client.get_user_info("240608458888445953")
                                    await self.client.send_message(david_dm,
                                                                   "Someone landed on 0 via roulette in `{}`".format(
                                                                       message.server.name))

                                if spin == 0:
                                    with open(
                                            'C:/Users/maxla/PycharmProjects/synapsBot remastered/roulette_outcomes.json',
                                            'r') as fp:
                                        outcomes = json.load(fp)
                                    outcomes['zero'] += 1
                                    with open(
                                            'C:/Users/maxla/PycharmProjects/synapsBot remastered/roulette_outcomes.json',
                                            'w') as fp:
                                        json.dump(outcomes, fp, sort_keys=True, indent=4)

                                    if outcomes_formatted == "zero":
                                        karma.user_add_karma(user_id, int(bet_amount * 14))
                                        msg = await self.client.send_message(
                                            message.channel,
                                            "Winner! :tada:\n You quattuordecuple up on karma for a total of "
                                            "`{}`!".format(karma.get_karma(user_id)))
                                        print("{0}: won on zero! {1}".format(curtime.get_time(), bet_amount))
                                        await self.client.pin_message(msg)
                                        return
                                    else:
                                        await self.client.send_message(
                                            message.channel,
                                            "Sorry, better luck next time. You now have `{}` karma".format(
                                                karma.get_karma(user_id)))
                                else:
                                    if spin % 2 == 0:
                                        with open(
                                                'C:/Users/maxla/PycharmProjects/synapsBot '
                                                'remastered/roulette_outcomes.json',
                                                'r') as fp:
                                            outcomes = json.load(fp)
                                        outcomes['even'] += 1
                                        with open(
                                                'C:/Users/maxla/PycharmProjects/synapsBot '
                                                'remastered/roulette_outcomes.json',
                                                'w') as fp:
                                            json.dump(outcomes, fp, sort_keys=True, indent=4)

                                        if outcomes_formatted == "even":
                                            karma.user_add_karma(user_id, int(bet_amount * 2))
                                            await self.client.send_message(message.channel,
                                                                           "Winner! :tada:\n You doubled up on karma "
                                                                           "for a total of `{}`!".format(
                                                                               karma.get_karma(user_id)))
                                        else:
                                            await self.client.send_message(
                                                message.channel,
                                                "Sorry, better luck next time. You now have `{}` karma".format(
                                                    karma.get_karma(user_id)))
                                    else:
                                        with open(
                                                'C:/Users/maxla/PycharmProjects/synapsBot '
                                                'remastered/roulette_outcomes.json', 'r') as fp:
                                            outcomes = json.load(fp)
                                        outcomes['odd'] += 1
                                        with open(
                                                'C:/Users/maxla/PycharmProjects/synapsBot '
                                                'remastered/roulette_outcomes.json', 'w') as fp:
                                            json.dump(outcomes, fp, sort_keys=True, indent=4)
                                        if outcomes_formatted == "odd":
                                            karma.user_add_karma(user_id, int(bet_amount * 2))
                                            await self.client.send_message(message.channel,
                                                                           "Winner! :tada:\n You doubled up on karma "
                                                                           "for a total of `{}`!".format(
                                                                               karma.get_karma(user_id)))
                                        else:
                                            await self.client.send_message(
                                                message.channel,
                                                "Sorry, better luck next time. You now have `{}` karma".format(
                                                    karma.get_karma(user_id)))
                            else:
                                await self.client.send_message(
                                    message.channel, "`ERROR:` You needed to enter `zero`, `even`, or `odd`")
                        else:
                            await self.client.send_message(message.channel,
                                                           "Sorry, you need to bet a number between `10` and `250`")
                            return

                if message.content.upper().startswith(".BANNEDWORDS"):
                    banned_words = settings.get_json(
                        "C:/Users/maxla/PycharmProjects/synapsBot remastered/banned_words.json")
                    await self.client.send_message(
                        message.channel, "**Banned Words List:** \n• `{}`".format("`\n• `".join(banned_words)))

                if message.content.upper().startswith(".INSULT"):
                    insults = settings.get_json("insults.json")
                    if not message.raw_mentions:
                        await self.client.send_message(message.channel,
                                                       "<@{}>, {}".format(message.author.id, random.choice(insults)))
                    else:
                        mention = message.raw_mentions[0]
                        if mention == self.client.user.id:
                            await self.client.send_message(message.channel,
                                                           "How original. No one else had thought of trying to get "
                                                           "the bot to insult itself. I applaud your creativity. "
                                                           "Yawn. Perhaps this is why you don't have friends. You "
                                                           "don't add anything new to any conversation. You are more "
                                                           "of a bot than me, predictable answers, and absolutely "
                                                           "dull to have an actual conversation with.")
                            return
                        await self.client.send_message(message.channel, "<@{}>, {}".format(message.raw_mentions[0],
                                                                                           random.choice(insults)))

        else:
            return
Beispiel #8
0
async def on_message(message):
    user_id = message.author.id
    user_name = message.author
    user_add_karma(user_id, 1)
    author_level = get_level(user_id)
    author_karma = get_karma(user_id)

    print('GAVE 1 karma to {0} ({1}) for a message.'.format(
        user_name, user_id))

    # Checks Karma / Level
    if author_karma > 100 * (author_level + 1):
        role_name = 'Level {}'.format(author_level + 1)
        level_role = discord.utils.get(message.server.roles, name=role_name)
        set_level(user_id, author_level + 1)
        await client.add_roles(user_name, level_role)
        await client.send_message(
            message.channel,
            "Congrats, <@{0}>! You're now level `{1}`.  :tada: ".format(
                user_id, author_level + 1))

    # '.accept' code
    role = discord.utils.get(message.server.roles, name=member_role_name)
    if member_role_id not in [role.id for role in message.author.roles]:
        if message.content.upper().startswith('.ACCEPT'):
            await client.add_roles(user_name, role)
            await client.delete_message(message)
            await client.send_message(
                discord.Object(id=notification_channel),
                '<@{}> is now a Member :ok_hand:'.format(user_id))
        else:
            await client.delete_message(message)

    # Karma System (BETA)
    elif message.content.upper().startswith('.KARMA'):
        if '!' in message.content[9:-1]:
            user_req = message.content[10:-1]
        else:
            user_req = message.content[9:-1]

        if message.content.upper()[7:] == 'HELP':
            embed = discord.Embed(title='Karma Commands:', color=0x0080c0)
            embed.add_field(name='.karma',
                            value='Returns your karma amount.',
                            inline=False)
            embed.add_field(name='.karma (@name)',
                            value='Returns (name'
                            's) karma amount.',
                            inline=False)
            embed.add_field(
                name='\u200b',
                value=
                'You get 5 karma for each upvote a link you post gets, and 1 for each'
                ' message you send.')
            await client.send_message(message.channel, embed=embed)
        elif message.content[7:] == '':
            await client.send_message(
                message.channel,
                'You have `{}` karma.'.format(get_karma(message.author.id)))
        else:
            await client.send_message(
                message.channel,
                '<@{0}> has `{1}` karma.'.format(user_req,
                                                 get_karma(user_req)))

    # Leveling
    elif message.content.upper().startswith('.LEVEL'):
        await client.send_message(message.channel,
                                  "You're level `{}`".format(author_level))

    # UD Code
    elif message.content.upper().startswith('.UD'):
        target_def = message.content[4:]

        try:
            term = udtop(target_def)
            embed = discord.Embed(
                title='Definition Page',
                url='https://www.urbandictionary.com/define.php?term={}'.
                format(target_def),
                color=0x0080c0)
            embed.set_author(name='Definition for ' + target_def,
                             url='https://www.urbandictionary.com/define.php?'
                             'term={}'.format(target_def))
            embed.set_footer(text=term)
        except AttributeError:
            await client.send_message(
                message.channel,
                'Sorry, `{0}` has no definition! You can add your own definition'
                ' at https://www.urbandictionary.com/add.php?word={1}'.format(
                    target_def, target_def))

    # 'Shut Up' code
    elif shut_up_role in [role.id for role in message.author.roles]:
        await client.send_message(message.channel,
                                  'Shut up <@{}>'.format(user_id))

    # Upvote Code
    elif 'HTTP' in message.content.upper():
        await client.add_reaction(message, upvote_emoji)

    # 8-Ball Code
    elif message.content.upper().startswith('.8BALL'):

        def get_answer(answer_number):
            if answer_number == 1:
                return 'It is certain'
            elif answer_number == 2:
                return 'It is decidedly so'
            elif answer_number == 3:
                return 'Yes'
            elif answer_number == 4:
                return 'Reply hazy try again'
            elif answer_number == 5:
                return 'Ask again later'
            elif answer_number == 6:
                return 'Concentrate and ask again'
            elif answer_number == 7:
                return 'My reply is no'
            elif answer_number == 8:
                return 'Outlook not so good'
            elif answer_number == 9:
                return 'Very doubtful'

        r = random.randint(1, 9)
        fortune = get_answer(r)
        await client.send_message(message.channel, fortune)

    # Ping Command
    elif message.content.upper().startswith('.PING'):
        await client.send_message(message.channel, 'Pong! :ping_pong:')

    # About Command
    elif message.content.upper().startswith('.ABOUT'):
        embed = discord.Embed(title='Github',
                              url='https://github.com/Mehvix/synaps-bot',
                              color=0x0080c0)
        embed.set_author(name='About:',
                         url='https://steamcommunity.com/id/Mehvix/')
        embed.set_thumbnail(url='https://goo.gl/FCddaV')
        embed.add_field(name='Creator:', value='\u200b', inline=True)
        embed.add_field(name='Mehvix#7172', value='\u200b', inline=True)
        await client.send_message(message.channel, embed=embed)

    # Help Command
    elif message.content.upper().startswith('.HELP'):
        embed = discord.Embed(title='Commands:', color=0x0080c0)
        embed.add_field(name='.uptime',
                        value='Returns however long the bot has been online.',
                        inline=False)
        embed.add_field(name='.8ball +question',
                        value='Returns the true answer to a question.',
                        inline=False)
        embed.add_field(name='.about',
                        value='Returns info on the bot.',
                        inline=False)
        embed.add_field(name='.karma',
                        value='Returns your karma amount.',
                        inline=False)
        embed.add_field(name='.karma @name',
                        value='Returns (name'
                        's) karma amount.',
                        inline=False)
        embed.add_field(name='.ud +word',
                        value='Returns (word) definition on Urban Dictionary.',
                        inline=False)
        await client.send_message(message.channel, embed=embed)

    # Server Rules Command
    elif admin_role_id in [role.id for role in message.author.roles]:
        if message.content.upper().startswith('.SERVERRULES'):
            await client.delete_message(message)
            embed = discord.Embed(
                title="Synaps Rules and Info",
                url="https://steamcommunity.com/groups/team_synaps",
                color=0x0080ff)
            embed.set_thumbnail(url="https://goo.gl/ibJU2z")
            embed.add_field(name='📜 Rules 1.)',
                            value='No spamming.',
                            inline=True)
            embed.add_field(name='👙 Rules 2.)',
                            value='No NSFW in Discussion.',
                            inline=True)
            embed.add_field(
                name='🎵 Rules 3.)',
                value='Please keep music requests in the music que channel.',
                inline=True)
            embed.add_field(
                name='🔰 Getting Verified:',
                value='Just add "[TS]" to your steam name and DM a Admin.',
                inline=True)
            embed.add_field(
                name='🔸 Getting Member:',
                value='Read the rules above and type ".accept" in this chat. If '
                'for whatever reason it doesnt work, contact an Admin.',
                inline=True)
            await client.send_message(message.channel, embed=embed)
            await client.send_message(message.channel, '**Team Synaps Links**')
            await client.send_message(
                message.channel,
                '• http://steamcommunity.com/groups/team_synaps')
            await client.send_message(
                message.channel,
                '• https://socialclub.rockstargames.com/crew/team_synaps')
            await client.send_message(
                message.channel, '• https://blizzard.com/invite/XKp33F07e)')

    elif message.content.upper().startswith('.UPTIME'):
        if days > .9:
            await client.send_message(
                message.channel,
                'The bot has been live for `{0}` day(s), `{1}` hours, `{1}` '
                'minute(s), and `{2}` second(s)! :clock1:'.format(
                    days, hours, minutes, seconds))
        elif hours > .9:
            await client.send_message(
                message.channel,
                'The bot has been live for `{0}` hour(s), `{1}` minute(s), and `{2}` second(s)!'
                ' :clock2:'.format(hours, minutes, seconds))
        elif minutes > .9:
            await client.send_message(
                message.channel,
                'The bot has been live for `{0}` minutes, `{1}` seconds :clock4:'
                .format(minutes, seconds))
        else:
            await client.send_message(
                message.channel,
                'The bot has been live for `{0}` second(s) :clock3:'.format(
                    seconds))