mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
* feat(Message): remove reply functionality * feat(InlineReplies): add INLINE_REPLY constant/typing * feat(InlineReplies): add Message#replyReference property * feat(InlineReplies): add typings for sending inline replies * feat(InlineReplies): provide support for inline-replying to messages * feat(Message): add referencedMessage getter * fix: check that Message#reference is defined in referencedMessage * refactor(InlineReplies): rename property, rework Message resolution * docs: update jsdoc for inline replies * feat(Message): inline reply method * fix(ApiMessage): finish renaming replyTo * fix: jsdocs for Message#referencedMessage Co-authored-by: Tristan Guichaoua <33934311+tguichaoua@users.noreply.github.com> * fix: restore reply typings * fix: dont pass channel_id to API when replying * chore: update jsdocs * chore: more jsdoc updates * feat(AllowedMentions): add typings for replied_user * fix: naming conventions * fix(Message): referenced_message is null, not undefined * fix(MessageMentionOptions): repliedUser should be optional * chore: get this back to the right state * fix(ApiMessage): pass allowed_mentions when replying without content * fix(ApiMessage): prevent mutation of client options Co-authored-by: almostSouji <timoqueezle@gmail.com> Co-authored-by: Tristan Guichaoua <33934311+tguichaoua@users.noreply.github.com>
32 lines
801 B
JavaScript
32 lines
801 B
JavaScript
'use strict';
|
|
|
|
/**
|
|
* Send a user a link to their avatar
|
|
*/
|
|
|
|
// Import the discord.js module
|
|
const Discord = require('discord.js');
|
|
|
|
// Create an instance of a Discord client
|
|
const client = new Discord.Client();
|
|
|
|
/**
|
|
* The ready event is vital, it means that only _after_ this will your bot start reacting to information
|
|
* received from Discord
|
|
*/
|
|
client.on('ready', () => {
|
|
console.log('I am ready!');
|
|
});
|
|
|
|
// Create an event listener for messages
|
|
client.on('message', message => {
|
|
// If the message is "what is my avatar"
|
|
if (message.content === 'what is my avatar') {
|
|
// Send the user's avatar URL
|
|
message.channel.send(message.author.displayAvatarURL());
|
|
}
|
|
});
|
|
|
|
// Log our bot in using the token from https://discord.com/developers/applications
|
|
client.login('your token here');
|