Write me a useful discord command, one would consider more of a utility in python that…
- User
Write me a useful discord command, one would consider more of a utility in python that would be imported into the mainbot script via a setup function like "def setup()
Assistant
Here's an example of a useful Discord command in Python that can be imported via a
setupfunction:import discord from discord.ext import commands def setup(bot): @bot.command() async def server_info(ctx): """Displays information about the server.""" guild = ctx.guild region = guild.region member_count = len(guild.members) created_at = guild.created_at embed = discord.Embed(title="Server Information", color=0x00ff00) embed.add_field(name="Server Name", value=guild.name) embed.add_field(name="Server ID", value=guild.id) embed.add_field(name="Server Owner", value=guild.owner.display_name) embed.add_field(name="Server Region", value=region) embed.add_field(name="Member Count", value=member_count) embed.add_field(name="Server Created At", value=created_at) await ctx.send(embed=embed) @bot.command() async def avatar(ctx, member: discord.Member = None): """Displays the avatar of a member.""" if member is None: member = ctx.author embed = discord.Embed(title="Avatar", color=0x00ff00) embed.set_image(url=member.avatar_url) await ctx.send(embed=embed) @bot.command() async def roles(ctx): """Displays a list of all roles in the server.""" roles = [role for role in guild.roles] rolenum = 1 message = "List of roles:\n" for role in roles: message += f"{rolenum}. {role.name}\n" rolenum += 1 embed = discord.Embed(title="Roles", color=0x00ff00) embed.description = message
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.