I am working on this command for a bot and I am not sure how I would get the text after an option, so like:
/userinfo name: Hatsune Miku
and prints out hatsune miku
in the end.
If you are using discord-interactions you can do:
In cogs
import discord
from discord.ext import commands
from discord_slash import cog_ext, SlashContext
from discord_slash.utils.manage_commands import create_option
class Slash(commands.Cog):
def __init__(self, client):
self.client = client
@cog_ext.cog_slash(name='userinfo', description="get user info", options=[create_option(name="name", description="Name", option_type=3, required=True)])
async def _userinfo(self, ctx, name):
await ctx.send(name)
in main.py
from discord_slash import SlashCommand
client = commands.Bot(...)
slash = SlashCommand(client, sync_commands=True)