mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
minor small fixes
This commit is contained in:
31
.gitignore
vendored
31
.gitignore
vendored
@@ -1 +1,30 @@
|
|||||||
node_modules/
|
# Created by https://www.gitignore.io
|
||||||
|
|
||||||
|
### Node ###
|
||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
|
||||||
|
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||||
|
lib-cov
|
||||||
|
|
||||||
|
# Coverage directory used by tools like istanbul
|
||||||
|
coverage
|
||||||
|
|
||||||
|
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||||
|
.grunt
|
||||||
|
|
||||||
|
# node-waf configuration
|
||||||
|
.lock-wscript
|
||||||
|
|
||||||
|
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
||||||
|
build/Release
|
||||||
|
|
||||||
|
# Dependency directory
|
||||||
|
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
|
||||||
|
node_modules
|
||||||
|
|||||||
44
README.md
44
README.md
@@ -1,2 +1,44 @@
|
|||||||
# discord.js
|
# discord.js
|
||||||
A JS interface for the Discord API.
|
Discord.js is a node module that allows you to interface with the [Discord](https://discordapp.com/) API for creation of things such as bots or loggers.
|
||||||
|
|
||||||
|
### Installation
|
||||||
|
``npm install discord.js``
|
||||||
|
|
||||||
|
### Example usage
|
||||||
|
```js
|
||||||
|
var Discord = require("discord.js");
|
||||||
|
|
||||||
|
var myBot = new Discord.Client();
|
||||||
|
|
||||||
|
myBot.login("discord email", "discord password", function(e) {
|
||||||
|
|
||||||
|
if(e){
|
||||||
|
console.log("Couldn't log in");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
myBot.on("disconnected", function() {
|
||||||
|
console.log("Disconnected!");
|
||||||
|
process.exit(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
myBot.on("ready", function(e) {
|
||||||
|
console.log("Ready to go!");
|
||||||
|
});
|
||||||
|
|
||||||
|
myBot.on("message", function(message) {
|
||||||
|
|
||||||
|
if(message.content === "Ping!"){
|
||||||
|
|
||||||
|
myBot.sendMessage(message.channel, "Pong!");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
### TODO
|
||||||
|
* Documentation
|
||||||
|
* Being able to cache new servers and channels as well as ones that are deleted - this is currently only done when a bot is created
|
||||||
|
|||||||
4
index.js
4
index.js
@@ -275,7 +275,7 @@ exports.Client.prototype.channelFromId = function(id){
|
|||||||
|
|
||||||
exports.Client.prototype.getChannelLogs = function(channel, amount, cb){
|
exports.Client.prototype.getChannelLogs = function(channel, amount, cb){
|
||||||
|
|
||||||
amount = amount || 0;
|
amount = amount+1 || 0;
|
||||||
var client = this;
|
var client = this;
|
||||||
|
|
||||||
request
|
request
|
||||||
@@ -289,6 +289,8 @@ exports.Client.prototype.getChannelLogs = function(channel, amount, cb){
|
|||||||
datList.add( new Message(item, channel) );
|
datList.add( new Message(item, channel) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
datList.removeIndex(0);
|
||||||
|
|
||||||
cb(datList);
|
cb(datList);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user