mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 10:03:31 +01:00
test script should wor
This commit is contained in:
64
test/bot.js
64
test/bot.js
@@ -3,62 +3,16 @@
|
||||
*/
|
||||
|
||||
var Discord = require("../");
|
||||
var Auth = require("./auth.json");
|
||||
var mybot = new Discord.Client();
|
||||
|
||||
mybot.login(Auth.email, Auth.password)
|
||||
mybot.login("email", "password").then(success).catch(error);
|
||||
|
||||
.then(function (token) {
|
||||
console.log("wooo!");
|
||||
}).catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
function success(){
|
||||
console.log("login successful");
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
mybot.on("ready", function () {
|
||||
console.log("Ready!");
|
||||
})
|
||||
|
||||
mybot.on("message", function (msg) {
|
||||
|
||||
if(msg.content === "pmme"){
|
||||
console.log("yes we found it!");
|
||||
mybot.setUsername("hydrabot").catch(function(err){
|
||||
console.log(err);
|
||||
});
|
||||
mybot.reply(msg, "You know what "+msg.sender+"? NO").then(function(msg){
|
||||
mybot.updateMessage(msg, "wat i sed nothin m8");
|
||||
});
|
||||
mybot.getChannelLogs(msg.channel).then(function(logs){
|
||||
console.log(logs[0]);
|
||||
}).catch(function(error){
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
mybot.on("messageDelete", function (channel, message) {
|
||||
|
||||
console.log("MESSAGE WAS DELETED BY " + (message ? message.author.username : channel.name));
|
||||
|
||||
});
|
||||
|
||||
mybot.on("messageUpdate", function (message, formerMessage) {
|
||||
|
||||
console.log(message.author.username, "changed", formerMessage.content, "to", message.content);
|
||||
|
||||
});
|
||||
|
||||
mybot.on("serverNewMember", function (user) {
|
||||
console.log("new user", user.username);
|
||||
});
|
||||
mybot.on("serverRemoveMember", function (user) {
|
||||
console.log("left user", user.username);
|
||||
});
|
||||
mybot.on("userUpdate", function (oldUser, newUser) {
|
||||
console.log(oldUser, "vs", newUser);
|
||||
});
|
||||
|
||||
mybot.on("channelCreate", function(chann){
|
||||
console.log(chann);
|
||||
})
|
||||
function error(){
|
||||
console.log("login error, but the API works");
|
||||
process.exit(0);
|
||||
}
|
||||
Reference in New Issue
Block a user