Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get bots to use discord commands? #46

Closed
PastaAdventures opened this issue Nov 5, 2015 · 20 comments
Closed

How to get bots to use discord commands? #46

PastaAdventures opened this issue Nov 5, 2015 · 20 comments

Comments

@PastaAdventures
Copy link

i want my bot to be able to use /tts and @

@khionu
Copy link
Contributor

khionu commented Nov 5, 2015

Using commands? Idk about.

Mentioning people? Here

var target = bot.getUser("username", stringWithUsername);
var response = target.mention + ", your message.";
bot.sendMessage(message.channel, response);

@PastaAdventures
Copy link
Author

I'm getting this error now

http://i.imgur.com/aKIHSvE.png

@khionu
Copy link
Contributor

khionu commented Nov 5, 2015

..... replace "stringWithUsername" so that it is a variable that has the username in in...

@amishshah
Copy link
Member

You can also make a message TTS by specifying the option parameter, check
the docs for Client.sendMessage for an example of this.

On Thu, 5 Nov 2015 7:13 am Khionu Terabite notifications@github.com wrote:

..... replace "stringWithUsername" so that it is a variable that has the
username in in...


Reply to this email directly or view it on GitHub
#46 (comment)
.

@khionu
Copy link
Contributor

khionu commented Nov 5, 2015

Good to know, re TTS

@PastaAdventures
Copy link
Author

so msg.sender.username?

@amishshah
Copy link
Member

If you want to mention them, no. If you just want their username, yep.

To mention do: msg.sender.mention() OR do msg.sender + ""

On Thu, 5 Nov 2015 7:21 am PastaAdventures notifications@github.com wrote:

so msg.sender.username?


Reply to this email directly or view it on GitHub
#46 (comment)
.

@khionu
Copy link
Contributor

khionu commented Nov 5, 2015

Or, if you want to mention the sender at the beginning bot.reply(message, "what you want to tell them");

@PastaAdventures
Copy link
Author

so this is suppose to send a tts msg?
if (msg.content === "!notice") {
bot.sendMessage(msg.channel, "Hey " + msg.sender.username + "!", true)
}

@khionu
Copy link
Contributor

khionu commented Nov 5, 2015

  1. Learn JS
  2. Read the Discord.JS documentation
  3. Read what we said above.

@PastaAdventures
Copy link
Author

ok, i think i'm good

@khionu
Copy link
Contributor

khionu commented Nov 5, 2015

That's not what. "msg.sender.username" is just going to give you the string. That's not what I showed you to Mention them.

@PastaAdventures
Copy link
Author

yeah, for this one i just want the string, but want the bot to tts the whole msg. Specifying the parameter for tts does not seem to make the bot tts the msg

@amishshah
Copy link
Member

Options is an object, not just true. You need to use:

{
tts:true
}

On Thu, 5 Nov 2015 7:57 am PastaAdventures notifications@github.com wrote:

yeah, for this on i just want the string, but wan the bot to tts the whole
msg


Reply to this email directly or view it on GitHub
#46 (comment)
.

@FedeCuci
Copy link

FedeCuci commented Jun 3, 2016

hi @khionu what do you mean by replacing "stringWithUsername" as a variable, I am new to discord.js so could you kindly show men how you can do this in javascript,

Thanks in advance!

@Azoy
Copy link

Azoy commented Jun 5, 2016

@FredyTek are you trying to send a message that mentions someone?

@abalabahaha
Copy link
Contributor

Please don't revive old issues... Make a new one if you have a question

@FedeCuci
Copy link

FedeCuci commented Jun 6, 2016

Yes @Azoy
I will @abalabahaha

@ChlckenWings
Copy link

can someone help me? what im trying to do is so if someone types "@botName hi" the bot will say whatever back but how do you get teh prefix to be the bots @?

@saysora
Copy link

saysora commented Feb 20, 2018

@ChlckenWings I got that to work by simply watching the message.content to include client.user which is my bot.

So, for example:
if(message.content.includes(client.user)){ message.channel.send('Yes?'); }

Hope that helps.

@discordjs discordjs locked as resolved and limited conversation to collaborators Feb 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants