Example #1
0
    async def _love(self, ctx):
        """Shows your special someone that you love them - Free."""
        believer = database.getBeliever(ctx.author.id, ctx.guild.id)
        marriage = database.getMarriage(believer.ID)

        if not marriage:
            await ctx.send("You are not married, bozo!")
            return

        # Update LoveDate
        database.doLove(marriage.ID)

        # Send message
        if marriage.Believer1.UserID == str(ctx.author.id):
            loverid = marriage.Believer2.UserID
        else:
            loverid = marriage.Believer1.UserID

        target = await botutils.getUser(self.bot, ctx.guild, loverid)

        if not target:
            await ctx.send("Awwhh, lover not found...")
            return

        # await ctx.send("<@" + loverid + "> - " + ctx.author.name + " loves you!")
        await ctx.send(
            embed=self.getMiscEmbed(believer, ctx.author, target, "KISS"))
Example #2
0
    async def _forcesetpriest(self, ctx, *args):
        """Set the priest of a God."""
        if len(args) < 2:
            await ctx.send("Include both a name and a user.")
            return

        god = database.getGodName(args[0], ctx.guild.id)
        if god:
            user = await botutils.getUser(self.bot, ctx.guild, args[1])
            if not user:
                await ctx.send("Could not fetch user!")
                return

            if not ctx.guild.get_member(user.id):
                await ctx.send("User is not in this server!")

            believer = database.getBeliever(user.id, ctx.guild.id)

            if believer:
                if believer.God.ID != god.ID:
                    database.setGod(believer.ID, god.ID)
            else:
                believer = database.newBeliever(user.id, god.ID)

            database.setPriest(god.ID, believer.ID)

            await ctx.send("Priest successfully set!")
    async def _divorce(self, ctx):
        """Leave your special someone and take the kids with you"""
        believer = database.getBeliever(ctx.author.id, ctx.guild.id)
        marriage = database.getMarriage(believer.ID)

        if not marriage:
            await ctx.send("You are not married, bozo!")
            return

        # Get partner
        if marriage.Believer1.UserID == str(ctx.author.id):
            loverid = marriage.Believer2.UserID
        else:
            loverid = marriage.Believer1.UserID

        database.deleteMarriage(marriage.ID)

        lover = await botutils.getUser(self.bot, ctx.guild, loverid)
        if not lover:
            await ctx.send(
                "Your lover could not be found!\n*But don't worry, we got ya' divorced anyway!*"
            )
        else:
            await ctx.send(ctx.author.name + " just divorced " + lover.name +
                           "!")
Example #4
0
def isNotMarried(ctx):
    believer = database.getBeliever(ctx.author.id, ctx.guild.id)
    if believer:
        married = database.getMarriage(believer.ID)

        if married:
            return False
    return True
Example #5
0
def isPriest(ctx):
    believer = database.getBeliever(ctx.author.id, ctx.guild.id)
    if believer:
        god = database.getGod(believer.God)
        if not god.Priest or god.Priest != believer.ID:
            return False
        else:
            return True
    return False
Example #6
0
    async def _access(self, ctx):
        """Set your religion as open or invite only - Priest only"""
        god = database.getBeliever(ctx.author.id, ctx.guild.id).God

        if god:
            if database.toggleAccess(god.ID):
                await ctx.send("God is now Invite Only!")
            else:
                await ctx.send("God is now Open!")
    async def _no(self, ctx):
        """Reject a proposal from your God"""
        believer = database.getBeliever(ctx.author.id, ctx.guild.id)
        priestoffer = database.getPriestOffer(believer.God.ID)

        database.deletePriestOffer(priestoffer.ID)
        await ctx.send("You have rejected " + believer.God.Name +
                       "'s request!")
        await botutils.doNewPriestOffer(self.bot, priestoffer.God, priestoffer)
    async def _yes(self, ctx):
        """Accept a proposal from your God"""
        believer = database.getBeliever(ctx.author.id, ctx.guild.id)
        priestoffer = database.getPriestOffer(believer.God.ID)

        database.setPriest(believer.God.ID, believer.ID)
        database.deletePriestOffer(priestoffer.ID)
        await ctx.send("You have accepted " + believer.God.Name +
                       "'s request!\n" + ctx.author.name + " is now the "
                       "Priest of " + believer.God.Name + "!")
Example #9
0
def hasOffer(ctx):
    believer = database.getBeliever(ctx.author.id, ctx.guild.id)
    if believer:
        priestoffer = database.getPriestOffer(believer.God)
        if not priestoffer:
            return False
        if not priestoffer.UserID == str(ctx.author.id):
            return False
        return True
    return False
Example #10
0
    async def _setgender(self, ctx, arg1):
        """Set the gender of your God to something else!"""
        god = database.getBeliever(ctx.author.id, ctx.guild.id).God
        if god:
            if len(arg1) > 19:
                await ctx.send(
                    "Please choose a gender that's not longer than 19 characters!"
                )
                return

            database.setGender(god.ID, arg1)
            await ctx.send("Gender successfully set to: " + arg1 + "!")
Example #11
0
    async def _invite(self, ctx, arg1):
        """Invite someone to your religion"""
        god = database.getBeliever(ctx.author.id, ctx.guild.id).God
        if god:
            user = await botutils.getUser(self.bot, ctx.guild, arg1)

            if not user:
                await ctx.send("User not found!")
                return

            if user.bot:
                await ctx.send(
                    "Sorry, but I don't think the bot is going to respond to your invitation..."
                )
                return

            if not ctx.guild.get_member(user.id):
                await ctx.send("The user is not in this server!")
                return

            believer = database.getBeliever(user.id, ctx.guild.id)
            if believer:
                if believer.God.ID == god.ID:
                    await ctx.send(user.name + " is already in your religion!")
                    return

            invite = database.getInvite(user.id, god.ID)
            if invite:
                await ctx.send(
                    "You already have an active invite for this user to join your God! Tell them to join!"
                )
                return

            if database.newInvite(god.ID, user.id):
                await ctx.send(
                    "An invite to your religion has been sent to the user!\n"
                    "*Invites will become invalid 24 hours after being issued.*"
                )
            else:
                await ctx.send("Creating the invite failed!")
Example #12
0
    async def _description(self, ctx, *args):
        """Sets a description for your religion"""
        god = database.getBeliever(ctx.author.id, ctx.guild.id).God

        if god:
            desc = ""
            for arg in args:
                desc = desc + " " + arg
            desc.strip()

            if len(desc) > 100:
                await ctx.send("Keep your description under 100 chars, please."
                               )
                return

            database.setDesc(god.ID, desc)
            await ctx.send("Description set successfully!")
Example #13
0
    async def _love(self, ctx):
        """Shows your special someone that you love them"""
        believer = database.getBeliever(ctx.author.id, ctx.guild.id)
        marriage = database.getMarriage(believer.ID)

        if not marriage:
            await ctx.send("You are not married, bozo!")
            return

        # Update LoveDate
        database.doLove(marriage.ID)

        # Send message
        if marriage.Believer1.UserID == str(ctx.author.id):
            loverid = marriage.Believer2.UserID
        else:
            loverid = marriage.Believer1.UserID
        await ctx.send("<@" + loverid + "> - " + ctx.author.name +
                       " loves you!")
Example #14
0
    async def _create(self, ctx, *args):
        """Creates a new God"""
        user = ctx.author

        if database.getBeliever(user.id, ctx.guild.id):
            await ctx.send(
                "You are already in a God, please leave it to create a new one using `/gods leave`!"
            )
            return

        if len(args) < 1:
            await ctx.send("Please give your God a name!")
            return

        if database.getGodName(args[0], ctx.guild.id):
            await ctx.send("A God with that name already exists!")
            return

        if len(args[0]) > 16:
            await ctx.send(
                "Please choose a name that's not longer than 16 characters!")
            return

        if len(args) > 1:
            if len(args[1]) > 19:
                await ctx.send(
                    "Please choose a gender that's not longer than 19 characters!"
                )
                return

            god = database.newGod(ctx.guild.id, args[0],
                                  random.choice(botutils.godtypes)[0], args[1])
        else:
            god = database.newGod(ctx.guild.id, args[0],
                                  random.choice(botutils.godtypes)[0])
        if god.ID:
            await ctx.send("God created!")
            believer = database.newBeliever(user.id, god)
            if believer.ID:
                logger.logDebug("Believer created!")
        else:
            await ctx.send("Boohoo, God creation failed...")
Example #15
0
    async def _join(self, ctx, arg1):
        """Joins a religion"""
        believer = database.getBeliever(ctx.author.id, ctx.guild.id)
        if believer:
            if arg1.upper() == believer.God.Name.upper():
                await ctx.send("You are already believing in this God!")
                return
            await ctx.send(
                "You are already in a God, please leave it to join a new one using `/gods leave`!"
            )
            return

        god = database.getGodName(arg1, ctx.guild.id)
        if not god:
            await ctx.send(
                "There is no God by that name... yet! `/gods create <name>`")
            return

        if god.InviteOnly:
            invite = database.getInvite(ctx.author.id, god.ID)
            if not invite:
                await ctx.send(
                    "That God is invite-only, and you don't have an invite...\n"
                    "Try contacting the Preist of the God for an invite!")
                return
            database.deleteInvite(invite.ID)

        database.newBeliever(ctx.author.id, god.ID)
        await ctx.send("You've now become a believer in the name of " +
                       god.Name + "!")

        priestoffer = database.getPriestOffer(god.ID)

        print(priestoffer)

        if not god.Priest and not database.getPriestOffer(god.ID):
            await botutils.doNewPriestOffer(self.bot, god)
            logger.logDebug(
                "Sent a new priest offer, God reached 3 believers!")
        else:
            logger.logDebug("God already had a preist or a priest offer")
Example #16
0
    async def _settype(self, ctx, arg1):
        """Set the type of your God to something else!"""
        god = database.getBeliever(ctx.author.id, ctx.guild.id).God
        if god:
            godTypes = []
            for godTypeSet in botutils.godtypes:
                godTypes.append(godTypeSet[0])

            if arg1.upper() in godTypes:
                database.setType(god.ID, arg1.upper())
                await ctx.send("Set your God's type successfully!")
            else:
                types_string = ""
                i = 1
                for type in godTypes:
                    if i == 1:
                        types_string = type
                    else:
                        types_string = types_string + ", " + type
                    i += 1
                await ctx.send("Please choose between these types: `" +
                               types_string + "`!")
Example #17
0
    async def _pray(self, ctx):
        """Pray to your God"""
        believer = database.getBeliever(ctx.author.id, ctx.guild.id)
        if not believer:
            return

        date = datetime.datetime.now()
        timediff = date - believer.PrayDate
        minutes = timediff.total_seconds() / 60

        if minutes >= 30:
            database.pray(believer)
            believer = database.getBelieverByID(believer.ID)

            await ctx.send(
                "You prayed to your God! Your prayer power is now **" +
                str(round(believer.PrayerPower, 2)) + "**!")
        else:
            timeTillPray = 30 - minutes
            await ctx.send("You cannot pray to your " +
                           botutils.getGodString(believer.God) +
                           " yet! Time remaining: " +
                           str(round(timeTillPray, 1)) + " minutes.")
Example #18
0
    async def _leave(self, ctx):
        """Leaves a religion"""
        user = ctx.author

        believer = database.getBeliever(ctx.author.id, ctx.guild.id)
        if not believer:
            return

        if database.leaveGod(user.id, ctx.guild.id):
            await ctx.send("You've left your god!")

            # If there aren't any believers in the God anymore, disband it
            if not database.getBelieversByID(believer.God):
                database.disbandGod(believer.God)
            elif believer.God.Priest == believer.ID:
                database.setPriest(believer.God.ID, None)

            # If the user was married, divorce them
            marriage = database.getMarriage(believer.ID)
            if marriage:
                database.deleteMarriage(marriage.ID)
        else:
            await ctx.send("Something went wrong...")
Example #19
0
    async def _hug(self, ctx, arg1):
        """Hugs someone, awhh - 0.5 Prayer Power."""
        believer = database.getBeliever(ctx.author.id, ctx.guild.id)
        if believer.PrayerPower < 0.5:
            await ctx.send(
                "Your Prayer Power is below 0.5! Try praying again, and then try hugging!"
            )
            return

        target = await botutils.getUser(self.bot, ctx.guild, arg1)
        if target.id == ctx.author.id:
            await ctx.send("You cannot hug yourself! Sad, we know...")
            return
        if target.bot:
            await ctx.send(
                "Even though I think the bot appreciates your hugs, I don't think it would feel it..."
            )
            return

        await ctx.send(
            embed=self.getMiscEmbed(believer, ctx.author, target, "HUGS"))

        database.subtractPrayerPower(believer.ID, 0.5)
Example #20
0
    async def _marry(self, ctx, arg1):
        """Marry that special someone"""
        guildid = ctx.guild.id
        user1 = ctx.author
        user2 = await botutils.getUser(self.bot, ctx.guild, arg1)

        believer1 = database.getBeliever(user1.id, guildid)
        believer2 = database.getBeliever(user2.id, guildid)

        if not believer1:
            await ctx.send("You are not believing in any religion!")
        elif database.getMarriage(believer1.ID):
            await ctx.send(
                "You are already married?! What are you trying to do?! - "
                "Maybe you should look at getting a divorce... `/g divorce`")
        elif not believer2:
            await ctx.send(
                "Your special someone is not believing in any religion!")
        elif database.getMarriage(believer2.ID):
            await ctx.send("Aww... Your special someone is already married...")
        elif believer1.God != believer2.God:
            await ctx.send(
                "You are not believing in the same God as your special someone!"
            )
        elif believer1 == believer2:
            await ctx.send("You can't marry yourself, bozo!")
        else:
            god = believer1.God
            embedcolor = discord.Color.dark_gold()
            if god.Type:
                for type, color in botutils.godtypes:
                    if type == god.Type:
                        embedcolor = color

            embed = discord.Embed(
                title="Marriage proposal",
                color=embedcolor,
                description="<@" + str(user2.id) + "> - " + user1.name +
                " wishes to marry you! "
                "Do you accept their proposal, to have and to hold each other, from this "
                "day forward, for better, for worse, for richer, for poorer, in sickness "
                "and in health, until death do you apart?")
            embed.set_image(url=random.choice(self.proposal_gifs))
            embed.set_author(name=user1.name + " wishes to marry " +
                             user2.name,
                             icon_url=self.bot.user.avatar_url)
            message = await ctx.send("<@" + str(user2.id) + ">", embed=embed)
            await message.add_reaction('👍')
            await message.add_reaction('👎')

            def check_for_react(reaction, user):
                return user == user2 and reaction.message.id == message.id and (
                    str(reaction.emoji) == '👍' or str(reaction.emoji) == '👎')

            try:
                reaction, user = await self.bot.wait_for('reaction_add',
                                                         timeout=60.0,
                                                         check=check_for_react)
            except asyncio.TimeoutError:
                await ctx.send("Awh, too slow!")
            else:
                accepted = str(reaction.emoji) == '👍'

                accepted_desc = str("<@" + str(user1.id) + "> and <@" +
                                    str(user2.id) +
                                    "> are now married in the name "
                                    "of **" +
                                    database.getGod(believer1.God).Name +
                                    "**!")
                state_text = "accepted" if accepted else "denied"
                embed = discord.Embed(
                    title="Marriage proposal " + state_text + "!",
                    color=embedcolor,
                    description=accepted_desc if accepted else None)
                embed.set_author(name=user1.name + " proposed to marry " +
                                 user2.name,
                                 icon_url=self.bot.user.avatar_url)

                if accepted:
                    database.newMarriage(believer1.ID, believer2.ID,
                                         believer1.God)
                    embed.set_image(url=random.choice(self.accept_gifs))
                else:
                    embed.set_image(url=random.choice(self.denial_gifs))

                await message.edit(content="", embed=embed)
Example #21
0
def isNotBeliever(ctx):
    believer = database.getBeliever(ctx.author.id, ctx.guild.id)
    if believer:
        return False
    return True
Example #22
0
    async def _info(self, ctx, *args):
        """Gets information about a God."""
        if len(args) > 0:
            god = database.getGodName(args[0], ctx.guild.id)
        else:
            believer = database.getBeliever(ctx.author.id, ctx.guild.id)
            if believer:
                god = database.getGod(believer.God)
            else:
                await ctx.send("Please give a God name!")
                return

        if not god:
            await ctx.send("That God doesn't exist!")
            return

        embedcolor = discord.Color.green()
        if god.Type:
            if god.Type.upper() == "YAOI":
                embedcolor = discord.Color.from_rgb(204, 235, 245)
            if god.Type.upper() == "TRAPS":
                embedcolor = discord.Color.from_rgb(248, 184, 248)
            for godtype, color in botutils.godtypes:
                if godtype == god.Type:
                    embedcolor = color

        title = god.Name + " - " + botutils.getGodString(
            god) + " of " + god.Type.capitalize()
        if god.Description:
            embed = discord.Embed(title=title,
                                  color=embedcolor,
                                  description=god.Description)
        else:
            embed = discord.Embed(title=title, color=embedcolor)
        embed.add_field(name="Creation Date",
                        value="%s" %
                        god.CreationDate.strftime("%Y-%m-%d %H:%M:%S"),
                        inline=True)
        believers = database.getBelieversByID(god.ID)
        if not believers:
            believers = []
        embed.add_field(name="Believers",
                        value="%s" % len(believers),
                        inline=True)
        embed.add_field(name="Power", value=round(god.Power, 1), inline=True)
        if god.Gender:
            embed.add_field(name="Gender:",
                            value=god.Gender.capitalize(),
                            inline=True)
        embed.add_field(name="Mood:",
                        value=botutils.getGodMood(god.Mood),
                        inline=True)
        embed.add_field(name="Invite Only:", value=god.InviteOnly, inline=True)
        if god.Priest:
            priest = self.bot.get_user(
                int(database.getBelieverByID(god.Priest).UserID))
            embed.set_footer(text="Priest: %s" % priest.name + "#" +
                             priest.discriminator,
                             icon_url=priest.avatar_url)
        else:
            embed.set_footer(text="This God has no priest yet!",
                             icon_url=self.bot.user.avatar_url)
        await ctx.send(embed=embed)