Ejemplo n.º 1
0
    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 +
                           "!")
Ejemplo n.º 2
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"))
Ejemplo n.º 3
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
Ejemplo n.º 4
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!")
Ejemplo n.º 5
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...")
Ejemplo n.º 6
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)