Exemple #1
0
    async def _forcesettype(self, ctx, *args):
        """Set the type of a God to something else."""
        if len(args) < 2:
            await ctx.send("Include both a name and a type!")
            return

        god = database.getGodName(args[0], ctx.guild.id)
        if god:
            godtypes = []
            for godTypeSet in botutils.godtypes:
                godtypes.append(godTypeSet[0])

            if args[1].upper() in godtypes:
                database.setType(god.ID, args[1].upper())
                await ctx.send("Set your God's type successfully!")
            else:
                types_string = ""
                i = 1
                for godtype in godtypes:
                    if i == 1:
                        types_string = godtype
                    else:
                        types_string = types_string + ", " + godtype
                    i += 1
                await ctx.send("Please choose between these types: `" +
                               types_string + "`!")
Exemple #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!")
Exemple #3
0
    async def _forcedescription(self, ctx, *args):
        """Forces a description for a religion."""
        if len(args) < 2:
            await ctx.send("Include both a name and a description!")
            return

        god = database.getGodName(args[0], ctx.guild.id)

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

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

            database.setDesc(god.ID, desc)
            await ctx.send("Description set successfully!")
        else:
            await ctx.send("No God found by that name!")
Exemple #4
0
 async def _forcedeletegod(self, ctx, arg1):
     """Removes a religion from the server."""
     god = database.getGodName(arg1, ctx.guild.id)
     if god:
         if botutils.disbandGod(god.ID):
             await ctx.send("God disbanded successfully!")
         else:
             await ctx.send("An error occurred doing that!")
     else:
         await ctx.send("A god with that name doesn't exist!")
    async def _forcesetgender(self, ctx, *args):
        """Set the gender of a God to something else!"""
        if len(args) < 2:
            await ctx.send("Include both a name and a gender!")
            return

        god = database.getGodName(args[0], ctx.guild.id)
        if god:
            if len(args[1]) > 19:
                await ctx.send("Please choose a gender that's not longer than 19 characters!")
                return

            database.setGender(god.ID, args[1])
            await ctx.send("Gender successfully set to: " + args[1] + "!")
Exemple #6
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...")
    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")
Exemple #8
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)