你好
(我是法语,对不起我的英语)
我希望我的机器人在特定的渠道中编辑消息,我尝试了很多代码,但没有一个起作用。
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]:
Syntax error or access violation: 1064 You have an error in your SQL syntax;
check the manual that corresponds to your MariaDB server version for the right syntax to
use near '?' at line 1' in C:\xampp\htdocs\mywebsite\test.php:31 Stack trace:
#0 C:\xampp\htdocs\mywebsite\test.php(31): PDO->prepare('SHOW COLUMNS FR...')
#1 {main} thrown in C:\xampp\htdocs\mywebsite\test.php on line 31
我也尝试使用let channels = Bot.guilds.find(g => g.id == "guild id").channels.filter(c => c.id == "another guild id").array();
channels.forEach(channel => {
channel.fetchMessage("message id").edit("Message Edited");
);
等...已定义for
,但无法获取任何消息...
感谢您的帮助!
答案 0 :(得分:0)
// Note: This code must be inside of an async function.
const guild = bot.guilds.get('guildIDhere');
if (!guild) return console.log('Unable to find guild.');
const channel = guild.channels.find(c => c.id === 'channelIDhere' && c.type === 'text');
if (!channel) return console.log('Unable to find channel.');
try {
const message = await channel.fetchMessage('messageIDhere');
if (!message) return console.log('Unable to find message.');
await message.edit('Test.');
console.log('Done.');
} catch(err) {
console.error(err);
}