Methods
Functions
Events
Attributes
Find The Mistake
100

Which one of these is a method?

msg.author

msg.channel.send

msg.author is correct:

msg.channel.send does something, while msg.author finds something

100
What does this function do?

msg.channel.send()

It sends a message back in the channel the command was sent in

100

What does this event check for?

bot.on("message");

It checks for when a message is sent.

100

What does this method find?

msg.author

It finds the user that sent the message

100

let channel = msg.channel;

channel.send(msg.author + " is your username.");

msg.author gets the object of the user who sent it, not their username.
200

Is this a method or a function?

msg.channel

It is a method:

while msg.channel.send is a function, msg.channel just finds the channel the message was sent in.

200

What does this function do?

msg.reply();

It sends a message in the same channel the command was sent in, mentioning the user who sent it first.

200
What does this event check for?

bot.on("guildMemberAdd");

It checks for when someone joins the server the bot is in.

200

What does this method find?

msg.guild.channels

It finds all the channels in the server!

200

if (!msg.author.username === "RandomUser") return;

msg.channel.send("Hello @RandomUser!"); 

You would use (value1 !== value2) instead of (!value1 === value2)

500

msg.guild.channels.find("name", "examplechannel");

Is this a method?

No:

although msg.guild and msg.guild.channels are both methods, it takes them and does something with them, making it a function.

500
What does this function do?

msg.channel.setTopic();

It sets the topic of the channel that the command was sent in.

500

What is the parameter in this event?


bot.on("message", something => {

It is the message that was sent.

500

What does this method find?

msg.tts

If the message was Text To Speech

500

const discord = require(discord.js);

const bot = new discord.Client();

discord.js should be in quotes, because it's a string.

750

msg.mentions.users.first();

Is this a method?

Yes:

Every part of that statement is a method: msg.mentions finds the mentions in the message, msg.users finds the users from those mentions, and msg.first gets the first one. None of these actually do an action.

750

What does this function do?

msg.channel.setParent();

It changes the category of the channel that the command was sent in.

750
What is the parameter in this event?

bot.on("guildMemberAdd", something => {

});

The member that joined.

750

What does this method find?

let server = msg.guild;

msg.server.channels;

Nothing: the code is wrong.

750

bot.on("message", () => {

}

There should be a parameter to the arrow function, like msg or message.

1000

Which one of these is not a method?

msg.author.username

msg.guild.members.find()

msg.guild.channels

msg.guild.members.find() is a function:

Although the msg.guild and msg.members are both methods, the find function does something: it finds an exact member.

1000

How would you fill in the blanks to make a command that would give the user that sent it a role?

let role = msg.guild.roles.find("name", "testrole");

__________.addRole(____);

You would use:

msg.member.addRole(role);

1000

What type of function is used in events?

Arrow functions (also known as callback functions)
1000

How would you fill in the blanks so that it is a command that finds a user and creates a new channel with their username?

let user = ___.mentions._____.first();

msg.____d.createChannel(user.________);

Like this:

let user = msg.mentions.users.first();

msg.guild.createChannel(user.username);

1000

let user = msg.mentions.users.first();

let role = msg.guild.roles.find("name", "testrole");

if (!user.roles.has(role)) return;

When checking a user for roles, you use the id:


if (!user.roles.has(role.id)) return;

M
e
n
u