示例#1
0
async def _removerole(ctx: SlashContext, role: discord.Role):
    userRoles = {
        user.id: user
        for user in await ctx.guild.fetch_members().flatten()
    }
    users = api.listUsers(cur, ctx.guild.id, role.id)
    api.removeRole(cur, ctx.guild.id, role.id)
    description = ' '.join(userRoles[user].mention for user in users)
    print(f"Removing role {role.id} from guild {ctx.guild.id}")
    embed = discord.Embed(title=f'Removing game',
                          description=description,
                          color=discord.Color.dark_red())
    embed.set_footer(text="Make sure you are aware!")
    if len(role.members) == 0:
        print(f"Deleting role {role.id} from guild {ctx.guild.id}")
        await role.delete(reason="No more notification subscriptions.")
        embed.add_field(name=':broken_heart: Deleting role',
                        value=f'Deleting role "{role.name}"',
                        inline=False)

    while len(description) > LIMITS['content']:
        v1, v2 = split_string(description, LIMITS['content'])
        ctx.send(content=v1)
        description = v2
    await ctx.send(content=description, embed=embed)
    con.commit()
示例#2
0
    async def _prefix(self, ctx: SlashContext, prefix: str):
        if len(prefix) > 5:
            return ctx.send("Prefixes cannot be longer than 5 characters!")

        guild_config = await GuildConfig.get_for_guild(ctx.guild.id)
        guild_config.prefix = prefix
        guild_config.save()

        embed = ConfigEmbed(guild_config=guild_config)
        await ctx.send(content="Config has been updated.", embeds=[embed])
示例#3
0
async def announce(ctx: SlashContext, title = None, body = None, channel = None):

  role = discord.utils.get(ctx.guild.roles, name="Staff")

  if role in ctx.author.roles:



    #channel = client.get_channel(channel)
    embed=discord.Embed(title=title, color=0xfff714)
    embed.set_author(name="ℹ️ Announcement")
    if channel != None:
      embed.add_field(name="-", value=body, inline=True)
      embed.set_footer(text="ℹ️ Announcement created by staff.")
      await channel.send(embed=embed)
      await ctx.send("Sent!")
    else:
      ctx.send("Missing channel")
  else:
    await ctx.send("You aren't apart of staff.")