Clickable command in text Discord - discord

I saw a YouTube video that shows you a way to display a "slash command" on Discord (see Image 1)
by sending "</any text:0>" (not clickable). I tried with any number at the end and its still working. So I tested </a slash command in my bot:MY BOT ID> and it was still working but it is not clickable.
Does anyone know a way to make a clickable slash command like in verified Discord bot profiles?
I am not sure it's possible but if someone knows how to do it.
Thanx in advance.

You can't control the 'Try my commands' section from appearing on your bot's profile. Discord will generate that section for your bot after a while of your bot being online & used.
In order to put clickable slash command buttons as you've shown you need to use the application command ID, not the bot id. You can find that by clicking on the prompt:
You can then take that ID to form </fast:972289487818334212>, which will be a clickable form of slash command.
Please note that slash command ids are changed randomly and frequently on Discord's end.

For sub-commands, you can do as such:
</cool-bot settings:2046185065514240342>
The command ID can be found under message.data.id, when your server receives a command.

Related

Need custom command options for discord bot without using slash commands

Can I attach slash command options to a custom command like "?help" and not "/help"?
I’m not entirely sure that I know what you mean, but I’ll try to answer.
?help is something we call a message command. It’s basically a message and is received as a messageCreate event. The bot then filters all message events to only respond to those with the specified prefix (in this case “?”). The only thing a user can submit via a message is the message content, a string, and attachments, which are files. You can access that via .content. You can make the user submit arguments by typing space and then e. g. writing a category name (?help moderation) which you could then recognise with <Message>.content.split(“ “);.
/help is, when registered as such, a slash command (interaction). When received, the interactionCreate event is called. When you register a slash command, you can add options such as string, integer, member and so on. These are registered beforehand and only in because of that, discord knows what options to give the user. And yeah, after that, you can access these options via the interaction.
To sum up (if I understand you correctly), you can’t attach (slash command) options to message commands because they are handled differently by discord. You can, however, utilise spaces to use these options. (Slash Commands are not using spaces but rely only on these options.)
I hope this helps.

How do i get the ID of a slash command and mention it?

I want to get the ID of a discord slash command to make a simailar thing that MEE6 has: (discord.js)
Help:
/help [command]
This makes you able to click on the slash command this is displayed inside of the message!
How do i do this?
I think it is </help:[ID of the slash command]>
Is this correct?
I've tried it but it didn't work...
Please help!
To get the slash commands ID you right click the dark box above the chatbox and press copy ID if that doesn't come up make sure Developer Mode is on under Settings > Advanced
To actually mention the slash command you use this syntax </name:id>

How do I pull a random gif from tenor in discord.py?

I'm doing a discord bot using discord.py and one of the functions I want to add is on a command !gif it sends a random gif from tenor. Is it possible to do that? So basically what I need is an explanation as to how to fetch GIFs from tenor.
You would need to query Tenors random gif api:
https://tenor.com/gifapi/documentation#endpoints-random
This requires you to provide a search term and will return a randomised list of gif for that keyword.
You can then respond to the command with either a link to the gif or the gif itself as a file.

How to add copy button to Discord Webhook embed message

In the image above, you can see the text with in blue color and the copy button.
I want to create the same thing, but don't know how to do it.
Does anyone know how to do it?
I just checked by joining the discord you sent. And the copy icon is just a simple icon with no use.
You can't at the moment make a "copy to clipboard" action using any sort of text inside an embed. (It was already suggested a while ago here)
Maybe Discord will add this feature someday.
If you just need to copy the exact same thing, they are doing something like:
[click me](https://google.com) 📋
Discord has not added this functionality yet. The icon there is likely just a small image.. However, you can use an external library called pyperclip. Then, run the following code with an interaction.(interactions are discord 2.0 stuff but are pretty stable in my opinion)
import pyperclip pyperclip.copy('The text to be copied to the clipboard.')

How to make my discord.js bot show how many servers it is in as it's status

I'd like to have my bot have a status that says how many servers it's in.
For example, in 6753421 guilds. I figure you'd make a separate section of code and add ${} to the status with the name of the function in it.
You need to use client.setActivity() and then use the client.guilds.cache.size value.
For example:
client.setActivity(`serving ${client.guilds.cache.size} servers`);

Resources