From cd2b79393ad4486297d1dc1cdebcbf1ff61554bb Mon Sep 17 00:00:00 2001 From: meew0 Date: Wed, 12 Aug 2015 13:54:39 +0200 Subject: [PATCH] Add an example to show message formatting --- examples/formatting.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 examples/formatting.js diff --git a/examples/formatting.js b/examples/formatting.js new file mode 100644 index 000000000..c12d0af5a --- /dev/null +++ b/examples/formatting.js @@ -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~~") + } +} );