Discord.js 票务系统不发送临时消息
Posted
技术标签:
【中文标题】Discord.js 票务系统不发送临时消息【英文标题】:Discord.js Ticket system doesn't send an ephemeral message 【发布时间】:2021-11-28 14:14:09 【问题描述】:我正在尝试使用 discord.js v13 制作票务系统,但临时方法不起作用,当我的机器人打开时,我需要单击一次按钮来激活系统。 print
我的代码:
const MessageActionRow, MessageButton, MessageEmbed, Permissions = require('discord.js');
const db = require("quick.db");
exports.run = async (client, interaction) =>
if (!interaction.isButton()) return;
interaction.deferUpdate();
let getContador = await db.get('counter')
if(getContador === null)
let contador = await db.set("counter", 1)
await db.add("counter", 1)
let tcID = "895323735702253569"
let tmID = "895358127950659604"
const filter = i => i.customId === 'OPENTICKET'
const collector = interaction.channel.createMessageComponentCollector( filter, max: 1 );
collector.on("collect", async i =>
let cTicket = await i.guild.channels.create(`????┆Ticket $getContador`,
type: 'GUILD_TEXT',
permissionOverwrites: [
id: i.guild.id,
deny: [Permissions.FLAGS.VIEW_CHANNEL],
,
id: i.user.id,
allow: [Permissions.FLAGS.VIEW_CHANNEL, Permissions.FLAGS.SEND_MESSAGES],
,
]
)
await interaction.channel.messages.cache.get(tmID).reply( content: `... $cTicket.toString()...`, ephemeral: true )
)
【问题讨论】:
【参考方案1】:您正在回复普通消息。如果您想要一个短暂的消息,您必须直接回复互动。
interaction.reply(
content: `... $cTicket.toString()...`,
ephemeral: true
)
【讨论】:
以上是关于Discord.js 票务系统不发送临时消息的主要内容,如果未能解决你的问题,请参考以下文章
Discord.js v12 如何获取对特定消息做出反应的人的 id?