Beispiel #1
0
 async def help(self, ctx, command_name: str = None):
     """*Shows this help message*"""
     prefix = get_guild_prefix(ctx.bot, ctx.guild.id)
     embed = await create_embed(
         title="Help",
         description=f"*Use `{prefix}help <command-name>` to get a more detailed help for a specific command!*"
         f"\n`<value>` is for required arguments and `[value]` for optional arguments!",
     )
     embed.set_footer(
         text="Thank you for using Daisy <3", icon_url=self.bot.user.avatar_url
     )
     if command_name is not None:
         cmd = ctx.bot.all_commands.get(command_name)
         if cmd is not None:
             embed.add_field(name=cmd.name, value=cmd.help.format(prefix=prefix))
             return await ctx.send(embed=embed)
     embed = await create_bot_help(embed, self.get_bot_mapping())
     await ctx.send(embed=embed)
Beispiel #2
0
    async def open(self, ctx, dodo_code: str, *, message: str):
        """*Open a custom listing*

        **Usage**: `{prefix}open <dodo-code> <message>`
        **Example**: `{prefix}open 123456 Hey come check out my Island!`"""
        if await self.check_user_banned(ctx):
            return
        prefix = get_guild_prefix(self.bot, ctx.guild.id)
        listing = await Listing.get(ctx.author.id)
        if listing:
            pass
        await Listing.create(
            user_id=ctx.author.id,
            guild_id=ctx.guild.id,
            invite_key=dodo_code,
            message=message,
            open_time=datetime.now(),
        )
        embed = await create_embed(
            description=
            f"Listing created. Please use `{prefix}close` once you're done!")
        set_footer(embed, ctx)
        await ctx.send(embed=embed)
Beispiel #3
0
    async def prefix(self, ctx, new_prefix: str = None):
        """*Change your servers prefix*

        **Example**: `{prefix}prefix !`
        **Requires permission**: `MANAGER SERVER`
        """
        if not new_prefix:
            prefix = get_guild_prefix(self.bot, ctx.guild.id)
            embed = discord.Embed(
                description=f"Prefix currently set to `{prefix}`")
            await ctx.send(embed=embed)
            return
        embed = discord.Embed(description="Prefix changed")
        guild = await Guild.get(ctx.guild.id)
        if guild is None:
            await Guild.create(id=ctx.guild.id, prefix=new_prefix)
            self.bot.guild_data[ctx.guild.id] = {"prefix": new_prefix}
        else:
            embed.add_field(name="From", value=guild.prefix)
            await guild.update(prefix=new_prefix).apply()
            self.bot.guild_data[ctx.guild.id].update({"prefix": new_prefix})

        embed.add_field(name="To", value=new_prefix)
        await ctx.channel.send(embed=embed)
Beispiel #4
0
async def get_prefix(_bot, message):
    prefix = config.prefix
    if not isinstance(message.channel, discord.DMChannel):
        prefix = get_guild_prefix(_bot, message.guild.id)
    return commands.when_mentioned_or(prefix)(_bot, message)
Beispiel #5
0
    async def profile(self, ctx, user_check: discord.User = None):
        """*Look up your or your friends profile*

        `[user]` is optional and either a user-id or a user mention
        **Usage**: `{prefix}profile [user]`
        **Example**: `{prefix}profile`

        To setup your own profile use the following commands
        **Usage**: `{prefix}profile <key> <value>`
        **Possible keys**:
            `island, name, fruit, hemisphere, fc, flower, airport, timezone`
        **Examples**:
            `{prefix}profile name Daisy`
            `{prefix}profile fruit cherry`
            `{prefix}profile hemisphere northern`
        """
        user = user_check
        if user is None:
            user = ctx.author
        profile = await query_profile(user.id)

        embed = await create_embed()
        if profile.island_name != "Not Set":
            embed.add_field(name="Island Name", value=profile.island_name)
        if profile.user_name != "Not Set":
            embed.add_field(name="Character Name", value=profile.user_name)
            embed.add_field(name="\u200c", value="\u200c")
        if is_northern_str(profile.is_northern):
            embed.add_field(name="Hemisphere", value=is_northern_str(profile.is_northern))
        if get_fruit(profile.fruit):
            embed.add_field(name="Fruit", value=get_fruit(profile.fruit))
            embed.add_field(name="\u200c", value="\u200c")
        if profile.flower:
            embed.add_field(name="Flower", value=profile.flower)
        if profile.airport:
            embed.add_field(name="Airport Color", value=profile.airport)
            embed.add_field(name="\u200c", value="\u200c")
        if profile.timezone:
            embed.add_field(name="Timezone", value=profile.timezone)
        if profile.friend_code != "Not Set":
            embed.add_field(name="Friend Code", value=profile.friend_code)

        if embed.fields:
            embed.set_thumbnail(url=user.avatar_url)
            embed.set_footer(text=f"Profile of {user.name}#{user.discriminator}")
        else:
            if user_check:
                embed.description = f"{user_check.mention} hasn't configured their profile yet!"
            else:
                prefix = get_guild_prefix(self.bot, ctx.guild.id)
                embed.description = (
                    f"**You haven't configured your profile yet!**\n"
                    f"To configure your profile use: \n`{prefix}profile <key> <value>`\n"
                    f"**Possible keys**: \n"
                    f"`island, name, fruit, hemisphere, fc, flower, airport, timezone`\n"
                    f"**Examples**:\n"
                    f"`{prefix}profile name Daisy`\n"
                    f"`{prefix}profile fruit cherry`\n"
                    f"`{prefix}profile hemisphere northern`\n"
                )
        await ctx.send(embed=embed)