Beispiel #1
0
    async def prefix(self, ctx, pref:str=None):
        """Change Killua's prefix with this command. If you forgot your prefix, mentioning is always a prefix as well"""

        guild = Guild(ctx.guild.id)

        if ctx.author.guild_permissions.administrator and pref:
            guild.change_prefix(pref)
            return await ctx.send(f'Successfully changed server prefix to `{pref}`!', allowed_mentions=discord.AllowedMentions.none())

        elif ctx.author.guild_permissions.administrator is False and pref:
            return await ctx.send('You need `administrator` permissions to change the server prefix!')

        await ctx.send(f'The current server prefix is `{guild.prefix}`', allowed_mentions=discord.AllowedMentions.none())
Beispiel #2
0
 async def daily(self, ctx):
     """Claim your daily Jenny with this command!"""
     now = datetime.utcnow()
     user = User(ctx.author.id)
     min = 50
     max = 100
     if user.is_premium:
         min *= 2
         max *= 2
     if ctx.guild and Guild(ctx.guild.id).is_premium:
         min *= 2
         max *= 2
     daily = randint(min, max)
     if user.is_entitled_to_double_jenny:
         daily *= 2
     if str(user.daily_cooldown) < str(now):
         user.claim_daily()
         user.add_jenny(daily)
         await ctx.send(
             f'You claimed your {daily} daily Jenny and hold now on to {user.jenny}'
         )
     else:
         cooldown = f"<t:{int(user.daily_cooldown.timestamp())}:R>"
         await ctx.send(
             f'You can claim your daily Jenny the next time in {cooldown}')
Beispiel #3
0
    async def on_guild_join(self, guild):
        #Changing the status
        await self.client.update_presence()
        Guild.add_default(guild.id)

        general = find(lambda x: x.name == 'general', guild.text_channels)
        if general and general.permissions_for(guild.me).send_messages:
            prefix = Guild(guild.id).prefix
            embed = discord.Embed.from_dict({
                'title':
                'Hello {}!'.format(guild.name),
                'description':
                f'Hi, my name is Killua, thank you for choosing me! \n\nTo get some info about me, use `{prefix}info`\n\nTo change the server prefix, use `{prefix}prefix <new prefix>` (you need administrator perms for that\n\nFor more commands, use `{prefix}help` to see every command\n\nPlease consider leaving feeback with `{prefix}fb` as this helps me improve Killua',
                'color':
                0x1400ff
            })
            await general.send(embed=embed)
        await self._post_guild_count()
Beispiel #4
0
 async def tag(self, ctx):
     if not Guild(ctx.guild.id).is_premium:
         view = discord.ui.View()
         view.add_item(
             discord.ui.Button(style=discord.ButtonStyle.grey,
                               label="Premium",
                               url="https://patreon.com/kilealkuri"))
         await ctx.send(
             "This command group is currently only a premium feature. To enable your guild to use it, become a Patreon!",
             file=PatreonBanner.file(),
             view=view)
         raise commands.CheckFailure  # I raise this error because it is the only one I ignore in the error handler. Hacky but whatever
Beispiel #5
0
    async def guild(self, ctx):
        """Displays infos about the current guild"""
        top = self._lb(ctx, limit=1)
        guild = Guild(ctx.guild.id)
        badges = ' '.join([GUILD_BADGES[b] for b in guild.badges])

        embed = discord.Embed.from_dict({
            "title":
            f"Information about {ctx.guild.name}",
            "fields": [{
                "name": "Owner",
                "value": str(ctx.guild.owner)
            }, {
                "name": "Killua Badges",
                "value": (badges if len(badges) > 0 else "No badges")
            }, {
                "name": "Combined Jenny",
                "value": top["points"]
            }, {
                "name":
                "Richest Member",
                "value":
                f'{top["top"][0]["name"]} with {top["top"][0]["points"]} jenny'
            }, {
                "name": "Server created at",
                "value": self.client.convert_to_timestamp(ctx.guild.id)
            }, {
                "name": "Members",
                "value": ctx.guild.member_count
            }],
            "description":
            str(ctx.guild.id),
            "thumbnail": {
                "url": str(ctx.guild.icon.url)
            },
            "color":
            0x1400ff
        })
        await self.client.send_message(ctx, embed=embed)
Beispiel #6
0
 async def on_guild_remove(self, guild):
     #Changing Killua's status
     await self.client.update_presence()
     Guild(guild.id).delete()
     await self._post_guild_count()
Beispiel #7
0
 async def update_guild_cache(self, data) -> None:
     """Makes sure the local cache is up to date with the db"""
     guild = Guild(data.id)
     guild.prefix = data.prefix
     guild.commands = {v for k, v in data.commands.items()}