mirror of
https://github.com/danbulant/discord.js
synced 2026-06-24 17:21:59 +00:00
Add an example to show message formatting
This commit is contained in:
parent
8d403a0274
commit
cd2b79393a
1 changed files with 17 additions and 0 deletions
17
examples/formatting.js
Normal file
17
examples/formatting.js
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
/*
|
||||||
|
* Discord uses a subset of Markdown for formatting, so adding formatting to
|
||||||
|
* messages is as simple as inserting the formatting codes into the message.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var Discord = require( "discord.js" );
|
||||||
|
var myBot = new Discord.Client();
|
||||||
|
|
||||||
|
myBot.login( "hello@example.com", "password1" );
|
||||||
|
|
||||||
|
myBot.on( "message", function( message ) {
|
||||||
|
// React to all messages with the content "$formatting".
|
||||||
|
if ( message.content === "$formatting" ) {
|
||||||
|
myBot.sendMessage( message.channel, "**bold** ****semibold**** *italic* " +
|
||||||
|
"_**bold and italic**_ __underline__ ~~strikethrough~~")
|
||||||
|
}
|
||||||
|
} );
|
||||||
Loading…
Reference in a new issue