最近两个小时我一直在尝试这个。完成乒乓球的表情符号后,我试图让我的机器人说“ HE TAKES SHOT”。我一直试图将表情符号存储到const中,但是它说ReferenceError:未定义客户端 请先帮忙
Caused by: com.coxautodev.graphql.tools.SchemaClassScannerError: Unable to match type definition (ListType{type=TypeName{name='QueryParameter'}}) with java type (class [Lcom.bd.model.QueryParameter;): Java class is not a List or generic type information was lost: class [Lcom.bd.model.QueryParameter;
答案 0 :(得分:0)
您正在尝试之前获取表情符号。Discord客户端有机会进行初始化和登录,因此无法访问表情符号。
假设您正在Discord.js v12上运行,则下面的代码应该可以工作:
const rootReducer: Reducer = (state: RootState, action: AnyAction) => {
if (action.type === "counter/logout") {
state = {} as RootState;
}
return combinedReducer(state, action);
};
如果您使用的是v11,则应改为const Discord = require('discord.js');
const bot = new Discord.Client();
const fs = require("fs");
const token = 'token';
const PREFIX = '!';
var bat = ('https://i.ytimg.com/vi/FZzQGSBHdyk/maxresdefault.jpg');
// Initialise bat1 as an empty variable
let bat1;
bot.on('ready', () =>{
// After the client has logged in, forward the emoji to bat1
bat1 = bot.emojis.cache.find(emoji => emoji.name === "bat1");
console.log('This bot is online!');
})
bot.on('message', message =>{
let args = message.content.substring(PREFIX.length).split(" ");
switch(args[0]){
case 'ping':
message.channel.send('pong')
break;
case 'info':
message.channel.send('PingPongBot is a project Eefan and sc0rps is working on, which hopefully will turn into a fully playable discord game! PingPongBot will also have some helpers, the one we have so far is Bananaprey!')
break;
case 'bat':
message.channel.send(bat)
break;
}
})
bot.on('message', msg =>{
if(msg.content === bat1){
msg.reply('HE TAKES THE SHOT');
}
})
bot.login(token);
。