Commit 5b4b3816 authored by Willow Snow's avatar Willow Snow Committed by Hugo "ThePooN" Denizart

README/examples enhancements (#3)

* Template literal > concat, and --save is implied.

* Prefer template literals to string concat

* Attempt to reinstate newlines

* Attempt to reinstate newlines
parent 7004c687
Pipeline #2157 passed with stage
in 2 minutes
......@@ -31,17 +31,17 @@ Normal accounts have undisclosed rate limits. This library, by default, uses lim
Let's get straight into it with a working example. This will print all your incoming PMs to the console:
```javascript
const Banchojs = require("bancho.js");
const client = new Banchojs.BanchoClient({username: "ThePooN", password:"your_irc_password"});
const client = new Banchojs.BanchoClient({ username: "ThePooN", password: "your_irc_password" });
client.connect().then(() => {
console.log("We're online! Now listening for incoming messages.");
client.on("PM", (message) => console.log(message.user.ircUsername+": "+message.message));
client.on("PM", (message) => console.log(`${message.user.ircUsername}: ${message.message}`));
}).catch(console.error);
```
Output:
```
Ghouru: notice me senpai
```
All you need to do to run this example is install bancho.js into your project (`npm i --save bancho.js`), paste this code into a file and replace my credentials with yours, from https://osu.ppy.sh/p/irc.
All you need to do to run this example is install bancho.js into your project (`npm i bancho.js`), paste this code into a file and replace my credentials with yours, from https://osu.ppy.sh/p/irc.
This library doesn't limit itself to sending messages though! It also has **complete multiplayer support** and the ability of firing API requests from BanchoUser objects, and much more! **Learn more with the [provided examples](https://github.com/ThePooN/bancho.js/tree/master/examples) and [documentation](https://bancho.js.org)!**
# Contributing
......@@ -52,4 +52,5 @@ You can financially support this project by [subscribing](https://twitch.tv/TheP
# License
It is licensed as GPL 3.0. The entire license text is available in the [LICENSE](/LICENSE) file, however I recommend you to take a look at this [short summary](https://choosealicense.com/licenses/gpl-3.0/) to get a better idea!
\ No newline at end of file
It is licensed as GPL 3.0. The entire license text is available in the [LICENSE](/LICENSE) file, however I recommend you to take a look at this [short summary](https://choosealicense.com/licenses/gpl-3.0/) to get a better idea!
......@@ -4,6 +4,7 @@ const client = new Banchojs.BanchoClient(require("../config.json"));
client.connect().then(() => {
console.log("We're online! Now listening for incoming messages.");
client.on("PM", (message) => {
console.log(message.user.ircUsername+": "+message.message);
console.log(`${message.user.ircUsername}: ${message.message}`);
});
}).catch(console.error);
\ No newline at end of file
}).catch(console.error);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment