Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
948 views
in Technique[技术] by (71.8m points)

discord.js - doing discord shortcut bot

I'm new to discord.py and i'm coding a bot. As you know there is a bot Groovy which is used for listening to youtube videos. And my bot will be used for shortcuts.

const Discord = require ('discord.js');
const client = new Discord.Client();
const prefix = '-';
 
client.on('message', message => {
if (!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).split(/ +/);
const command = args.shift().toLowerCase();

if(command==='kids'){
    message.channel.send('-p  Kids Cheering - Gaming Sound Effect (HD) ')} });

As you see whenever someone write "-kids" on the chat, bot will write "-p Kids Cheering - Gaming Sound Effect (HD)" on the chat. But i want it to be read by Groovy so that groovy plays it. I tried it but it wasn't read by groovy. What should i do? Any reponse will be appreciated. Thank you

question from:https://stackoverflow.com/questions/65861023/doing-discord-shortcut-bot

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can't force Groovy to read it. Bots by default don't listen to other bots, and most devs don't make their bots do that either (to avoid spam, for example). If Groovy doesn't listen to bots, there's nothing you can do to make it listen.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...