I am trying to send a message to a channel when a client executes a specific slash command.
The command should send a embed that will contain a field. I want to make that field “clickable” so that people can join.
I want them to join a steam game server (CS:GO) that uses the protocol steam://connect/ip:port/password to connect.
I tried the following to send the message:
const { SlashCommandBuilder } = require('@discordjs/builders');
const { MessageEmbed } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('stackoverflow')
.setDescription('Question to stackoverflow'),
async execute(interaction) {
const embed = new MessageEmbed()
.setColor('#ff0000')
.setTitle('test')
.setAuthor({
name: 'Test'
})
.setDescription('Testing')
.addField('Click below to join the server', '[Click here](steam://node1.spirtshop.cf:6002/TestesNexus!2022)')
.addFields(
{ name: 'u200b', value: '[Join the server](steam://node1.spirtshop.cf:6002/TestesNexus!2022)'},
{ name: 'Connect through the console', value: 'connect node1.spirtshop.cf:6002; password TestesNexus!2022'}
)
.setTimestamp()
.setFooter({
text: 'Just testing'
});
await interaction.reply({embeds: });
},
};
Unfortunately, this doesn’t work: (output) -> https://i.imgur.com/D4xCCVm.png
I’ve found some bots written in python, however, I couldn’t take that into NodeJS. In my interpretation Discord just recognizes as a “clickable link” if I send it as the protocol(?).
The expected result is something like this: https://i.imgur.com/UcERDcM.png
From that screen shot, I just want to replace the steam://…. with some text.
Any idea of how I can make this?
(using nodejs v17.4.0, discordjs v13.6.0)