コード例 #1
0
ファイル: moderation_admin.py プロジェクト: 11Tuvork28/M3E5
 async def clear_infractions(self, ctx, member: discord.Member = None):
     warnings = await self.client.sql.get_warns(ctx.guild.id, member.id)
     e = build_embed(
         author=self.client.user.name,
         author_img=self.client.user.avatar_url,
         title="Infractions cleared!",
         description=
         f"{member} Had {warnings} infractions but now {member} has 0!",
         timestamp=datetime.datetime.now(),
     )
     await ctx.send(embed=e)
     self.client.cache.states[ctx.guild.id].users[
         ctx.author.id].warn_count = 0
     edit_warns.delay(ctx.guild.id, member.id, 0)
     return e
コード例 #2
0
ファイル: infocommands.py プロジェクト: 11Tuvork28/M3E5
 async def profile(self, ctx):
     xp = await self.client.sql.get_text_xp(ctx.guild.id, ctx.author.id)
     lvl = await self.client.sql.get_lvl_text(ctx.guild.id, ctx.author.id)
     warnings = await self.client.sql.get_warns(ctx.guild.id, ctx.author.id)
     e = build_embed(author=ctx.author.display_name,
                     author_img=ctx.author.avatar_url,
                     timestamp=datetime.datetime.now(),
                     footer=self.client.user.name)
     e.title = "Your profile"
     e.description = ctx.author.mention
     e.add_field(
         name="Writer rank",
         value=f"**#{lvl}** with {xp}/{int((lvl+1)**(1/float(1/4)))}XP",
         inline=False)
     e.add_field(name="Warnings", value=f"You have {warnings} warning(s)!")
     await ctx.send(embed=e)
コード例 #3
0
ファイル: infocommands.py プロジェクト: 11Tuvork28/M3E5
 async def server_info(self, ctx):
     e = build_embed(title=ctx.guild.name,
                     author=self.client.user.name,
                     author_img=self.client.user.avatar_url,
                     thumbnail=ctx.guild.icon_url,
                     description="Here are some infos about this guild",
                     timestamp=datetime.datetime.now())
     e.add_field(name="Members", value=ctx.guild.member_count)
     e.add_field(name="Owner", value=ctx.guild.owner)
     e.add_field(name="Roles", value=len(ctx.guild.roles))
     e.add_field(name="Created at", value=ctx.guild.created_at)
     e.add_field(name="AFK channel", value=ctx.guild.afk_channel)
     e.add_field(name="AFK timeout", value=ctx.guild.afk_timeout)
     e.add_field(name="Emoji limit", value=ctx.guild.emoji_limit)
     e.add_field(name="Bitrate limit", value=ctx.guild.bitrate_limit)
     e.add_field(name="Filesize limit", value=ctx.guild.filesize_limit)
     await ctx.send(embed=e)
コード例 #4
0
 async def on_guild_join(self, guild: discord.Guild):
     self.client.sql.updatedb(guild)
     message = build_embed(author=self.client.user.name,
                           title="Hey!",
                           description="Thanks for choosing me!"
                           "here are some commands you need to execute:")
     message.add_field(
         name="Important setup commands",
         value="-prefix the prefix\n -set_leave\n -set_welcome\n"
         "-set_lvl\n -set_cmd\n -set_default\n -set_dev\n"
         " -set_mod\n set_admin",
         inline=True)
     message.add_field(
         name="Usage",
         value=
         "sets the prefix\n sets the leave channel\n sets the welcome channel\n "
         "sets the lvl up channel\n sets the channel for bot commands\n "
         "sets the default role a user should have on join\n "
         "sets the dev role\n sets the mod role\n sets the admin role")
     await guild.owner.send(embed=message)
     self.client.cache.create_state(guild.id)
コード例 #5
0
 async def on_member_remove(self, member):
     if member.id == self.client.user.id:
         return
     stdoutchannel = self.client.get_channel(
         self.client.cache.states[member.guild.id].get_channel())
     if stdoutchannel is not None:
         await self.client.log.stdout(
             stdoutchannel,
             f"Member {member.name} left or got banned/kicked")
     channel_id = await self.client.sql.get_leave_channel(
         self.client, member.guild.id)
     channel = member.guild.get_channel(channel_id)
     r = await self.client.sql.get_leave_text(member.guild.id)
     content = base64.b64decode(str(r.encode("utf8"))).decode("utf8") \
         .replace("user", member.name) \
         .replace("server", member.guild.name)
     e = build_embed(author=self.client.user.name,
                     author_img=self.client.user.avatart_url,
                     timestamp=datetime.datetime.now(),
                     thumbnail=member.avatar_url,
                     title="Bye Bye")
     e.description = content
     await channel.send(embed=e)