mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 11:33:30 +01:00
* Update examples * Forgot to save send-files
This commit is contained in:
committed by
abalabahaha
parent
b9506d01ab
commit
8d64435def
@@ -1,3 +0,0 @@
|
|||||||
# Warning!
|
|
||||||
|
|
||||||
### These examples are not updated to v5.0.0, may not work!
|
|
||||||
@@ -9,10 +9,6 @@ var loose = false;
|
|||||||
|
|
||||||
bot.on("message", msg => {
|
bot.on("message", msg => {
|
||||||
|
|
||||||
if (~msg.content.indexOf("https://discord.gg/")) {
|
|
||||||
bot.joinServer(msg.content.substr(msg.content.indexOf("https://discord.gg/"), "https://discord.gg/".length + 16));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!msg.content.startsWith("$")) return;
|
if (!msg.content.startsWith("$")) return;
|
||||||
|
|
||||||
msg.content = msg.content.substr(1);
|
msg.content = msg.content.substr(1);
|
||||||
@@ -23,40 +19,40 @@ bot.on("message", msg => {
|
|||||||
`${bot.servers.length} servers`,
|
`${bot.servers.length} servers`,
|
||||||
`${bot.channels.length} channels`,
|
`${bot.channels.length} channels`,
|
||||||
`${bot.users.length} users`,
|
`${bot.users.length} users`,
|
||||||
].join("\n"));
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg.content.startsWith("startplaying")) {
|
else if (msg.content.startsWith("startplaying")) {
|
||||||
var game = msg.content.split(" ").slice(1).join(" ");
|
var game = msg.content.split(" ").slice(1).join(" ");
|
||||||
bot.setPlayingGame(game);
|
bot.setPlayingGame(game);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg.content.startsWith("setname") && loose) {
|
else if (msg.content.startsWith("setname") && loose) {
|
||||||
bot.setUsername(msg.content.split(" ").slice(1).join(" ")).then(() => {
|
bot.setUsername(msg.content.split(" ").slice(1).join(" ")).then(() => {
|
||||||
msg.reply("done!");
|
msg.reply("Done!");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg.content === "updateav") {
|
else if (msg.content === "updateav") {
|
||||||
request
|
request
|
||||||
.get("https://api.github.com/search/repositories?q=discord.js")
|
.get("https://api.github.com/search/repositories?q=discord.js")
|
||||||
.end((err, res) => {
|
.end((err, res) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var text = res.body.items[0].stargazers_count
|
var text = res.body.items[0].stargazers_count
|
||||||
|
|
||||||
bot.updateDetails({
|
bot.updateDetails({
|
||||||
username : "d.js star bot - " + text,
|
username : "d.js star bot - " + text,
|
||||||
avatar: getStars(text)
|
avatar: getStars(text)
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
msg.reply("success!");
|
msg.reply("Success!");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg.content.startsWith("setavatar") && loose) {
|
else if (msg.content.startsWith("setavatar") && loose) {
|
||||||
request
|
request
|
||||||
.get(msg.content.split(" ")[1])
|
.get(msg.content.split(" ")[1])
|
||||||
.end((err, res) => {
|
.end((err, res) => {
|
||||||
@@ -70,23 +66,23 @@ bot.on("message", msg => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg.content === "away") {
|
else if (msg.content === "away") {
|
||||||
bot.setStatusIdle();
|
bot.setStatusIdle();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg.content === "here") {
|
else if (msg.content === "here") {
|
||||||
bot.setStatusOnline();
|
bot.setStatusOnline();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg.content === "randomUser") {
|
else if (msg.content === "randomUser") {
|
||||||
var random = bot.users.random();
|
var random = bot.users.random();
|
||||||
msg.reply([
|
msg.reply([
|
||||||
random.username,
|
random.username,
|
||||||
"avatar: ", random.avatarURL
|
"avatar: ", random.avatarURL
|
||||||
].join("\n"));
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg.content.startsWith("mimic") && loose) {
|
else if (msg.content.startsWith("mimic") && loose) {
|
||||||
var toMimic = msg.mentions[0];
|
var toMimic = msg.mentions[0];
|
||||||
|
|
||||||
if (!toMimic) {
|
if (!toMimic) {
|
||||||
@@ -109,7 +105,7 @@ bot.on("message", msg => {
|
|||||||
avatar: res.body
|
avatar: res.body
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
|
|
||||||
msg.reply("done!");
|
msg.reply("Done!");
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -126,9 +122,9 @@ setInterval(() => {
|
|||||||
if (err) {
|
if (err) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var text = res.body.items[0].stargazers_count
|
var text = res.body.items[0].stargazers_count
|
||||||
|
|
||||||
bot.updateDetails({
|
bot.updateDetails({
|
||||||
username : "d.js star bot - " + text,
|
username : "d.js star bot - " + text,
|
||||||
avatar: getStars(text)
|
avatar: getStars(text)
|
||||||
@@ -144,7 +140,7 @@ bot.on("disconnected", () => {
|
|||||||
process.exit();
|
process.exit();
|
||||||
})
|
})
|
||||||
|
|
||||||
bot.login(auth.email, auth.password);
|
bot.loginWithToken(auth.token);
|
||||||
|
|
||||||
function getStars(text) {
|
function getStars(text) {
|
||||||
var Canvas = require('canvas')
|
var Canvas = require('canvas')
|
||||||
@@ -154,7 +150,7 @@ function getStars(text) {
|
|||||||
|
|
||||||
ctx.fillStyle = "black";
|
ctx.fillStyle = "black";
|
||||||
ctx.fillRect(0, 0, 90, 90);
|
ctx.fillRect(0, 0, 90, 90);
|
||||||
|
|
||||||
ctx.font = '45px Arial';
|
ctx.font = '45px Arial';
|
||||||
ctx.fillStyle = "white";
|
ctx.fillStyle = "white";
|
||||||
ctx.fillText(text, (ctx.measureText(text).width / 2) - 5, 60);
|
ctx.fillText(text, (ctx.measureText(text).width / 2) - 5, 60);
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
{
|
{
|
||||||
"email" : "your discord email here",
|
"token": "Your bot token here"
|
||||||
"password" : "your discord password here"
|
|
||||||
}
|
}
|
||||||
@@ -9,23 +9,23 @@ var AuthDetails = require("./auth.json");
|
|||||||
var bot = new Discord.Client();
|
var bot = new Discord.Client();
|
||||||
|
|
||||||
bot.on("ready", () => {
|
bot.on("ready", () => {
|
||||||
console.log("Ready to begin! Serving in " + bot.channels.length + " channels");
|
console.log(`Ready to begin! Serving in ${bot.channels.length} channels`);
|
||||||
});
|
});
|
||||||
|
|
||||||
bot.on("disconnected", () => {
|
bot.on("disconnected", () => {
|
||||||
|
|
||||||
console.log("Disconnected!");
|
console.log("Disconnected!");
|
||||||
process.exit(1); //exit node.js with an error
|
process.exit(1); //exit node.js with an error
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
bot.on("message", (msg) => {
|
bot.on("message", (msg) => {
|
||||||
|
|
||||||
if( msg.content === "avatar" ){
|
// if the message is avatar
|
||||||
// if the message was avatar
|
if (msg.content === "avatar") {
|
||||||
bot.reply( msg, msg.sender.avatarURL );
|
bot.reply(msg, "Here is the URL for your avatar: " + msg.author.avatarURL);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
bot.login(AuthDetails.email, AuthDetails.password);
|
bot.loginWithToken(AuthDetails.token);
|
||||||
@@ -1,87 +1,72 @@
|
|||||||
/*
|
|
||||||
this bot is a permissions bot and is currently working
|
|
||||||
with the experimental additions. Some functions may
|
|
||||||
change in the future.
|
|
||||||
*/
|
|
||||||
|
|
||||||
var Discord = require("../../");
|
var Discord = require("../../");
|
||||||
|
|
||||||
// Get the email and password
|
// Get the token
|
||||||
var AuthDetails = require("../auth.json");
|
var AuthDetails = require("../auth.json");
|
||||||
|
|
||||||
var bot = new Discord.Client();
|
var bot = new Discord.Client();
|
||||||
|
|
||||||
bot.on("ready", function () {
|
bot.on("ready", function () {
|
||||||
console.log("Ready to begin! Serving in " + bot.channels.length + " channels");
|
console.log(`Ready to begin! Serving in ${bot.channels.length} channels`);
|
||||||
});
|
});
|
||||||
|
|
||||||
bot.on("disconnected", function () {
|
bot.on("disconnected", function () {
|
||||||
|
|
||||||
console.log("Disconnected!");
|
console.log("Disconnected!");
|
||||||
process.exit(1); //exit node.js with an error
|
process.exit(1); //exit node.js with an error
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
bot.on("message", function (msg) {
|
bot.on("message", function (msg) {
|
||||||
if (msg.content === "skype") {
|
if (msg.content === "skype") {
|
||||||
|
|
||||||
//stop the user from speaking in the channel:
|
//stop the user from speaking in the channel:
|
||||||
bot.overwritePermissions(msg.channel, msg.sender, {
|
bot.overwritePermissions(msg.channel, msg.author, {
|
||||||
sendMessages: false
|
sendMessages: false
|
||||||
});
|
});
|
||||||
|
|
||||||
// send a barely funny message ;)
|
// send a barely funny message ;)
|
||||||
bot.reply(msg, "how dare you mention that!");
|
bot.reply(msg, "How dare you mention that!");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg.content === "discord") {
|
if (msg.content === "discord") {
|
||||||
|
|
||||||
|
var role = msg.server.roles.get("name", "good people");
|
||||||
|
|
||||||
// if the role doesn't exist, make it
|
// if the role doesn't exist, make it
|
||||||
bot.createRoleIfNotExists(msg.channel.server, {
|
if (!role) {
|
||||||
name: "good people",
|
bot.createRole(msg.server, {
|
||||||
color: Discord.Colors.BLUE, // colour of blue
|
name: "good people",
|
||||||
hoist: true // make a seperate category in the users list
|
color: "0000FF", // blue
|
||||||
}).then(addUserToList).catch(console.log);
|
hoist: true // make a seperate category in the users list
|
||||||
|
}).then(createdRole => {
|
||||||
function addUserToList(role, alreadyExists) {
|
role = createdRole;
|
||||||
console.log(arguments);
|
}).catch(console.log);
|
||||||
bot.addMemberToRole(msg.sender, role);
|
|
||||||
bot.reply(msg, "welcome to the good people! " + alreadyExists);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bot.addMemberToRole(msg.author, role);
|
||||||
|
bot.reply(msg, "Welcome to the good people!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg.content === "remove me") {
|
if (msg.content === "remove me") {
|
||||||
// remove the user from the good people list, if it exists
|
// remove the user from the good people list, if it exists
|
||||||
var found = false;
|
var role = msg.server.roles.get("name", "good people");
|
||||||
|
|
||||||
for (var role of msg.channel.server.roles) {
|
if (role) { // if the role exists
|
||||||
if (role.name === "good people") {
|
|
||||||
found = role;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (found) {
|
if (msg.author.hasRole(role)) {
|
||||||
// if the role exists
|
|
||||||
|
|
||||||
if (msg.sender.hasRole(role)) {
|
|
||||||
// remove the member from the role
|
// remove the member from the role
|
||||||
bot.removeMemberFromRole(msg.sender, role);
|
bot.removeMemberFromRole(msg.author, role);
|
||||||
bot.reply(msg, "removed!")
|
bot.reply(msg, "Removed!")
|
||||||
} else {
|
} else {
|
||||||
bot.reply(msg, "you're not in the role!");
|
bot.reply(msg, "You're not in the role!");
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// role doesn't exist
|
// role doesn't exist
|
||||||
bot.reply(msg, "the role doesn't even exist!");
|
bot.reply(msg, "The role doesn't even exist!");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
bot.login(AuthDetails.email, AuthDetails.password);
|
bot.loginWithToken(AuthDetails.token);
|
||||||
@@ -18,58 +18,30 @@ bot.on("disconnected", function () {
|
|||||||
|
|
||||||
console.log("Disconnected!");
|
console.log("Disconnected!");
|
||||||
process.exit(1); //exit node.js with an error
|
process.exit(1); //exit node.js with an error
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
bot.on("message", function (msg) {
|
bot.on("message", function (msg) {
|
||||||
|
|
||||||
// to use this example, you first have to send 'create role'
|
// to use this example, you first have to send 'create role'
|
||||||
// you can then change colors afterwards.
|
// you can then change colors afterwards.
|
||||||
|
|
||||||
if (msg.content === "create role") {
|
if (msg.content === "create role") {
|
||||||
// create the role and add the user to it
|
// create the role and add the user to it
|
||||||
|
|
||||||
bot.createRoleIfNotExists(msg.channel.server, {
|
bot.createRole(msg.server, {
|
||||||
name: "Custom Colors",
|
name: "Custom Colors",
|
||||||
hoist: true, // so it is visible in the members list
|
hoist: true, // so it is visible in the members list
|
||||||
}).then(function (permission) {
|
}).then(createdRole => { // this is executed when the role has been created
|
||||||
// this is executed when the role has been created or exists
|
|
||||||
|
|
||||||
// adds the sender to the role
|
|
||||||
bot.addMemberToRole(msg.sender, permission).then(function () {
|
|
||||||
bot.reply(msg, "added you to the role!");
|
|
||||||
});
|
|
||||||
|
|
||||||
|
// adds the sernder to the role
|
||||||
|
bot.addMemberToRole(msg.author, createdRole).then(() => {
|
||||||
|
bot.reply(msg, "Added you to the role!");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg.content.indexOf("preset color") === 0) {
|
else if (msg.content.startsWith("custom color")) {
|
||||||
|
|
||||||
// set the role to a preset color
|
|
||||||
var colorName = msg.content.split(" ")[2];
|
|
||||||
|
|
||||||
// get the role by its name
|
|
||||||
var role = msg.channel.server.getRole("name", "Custom Colors");
|
|
||||||
|
|
||||||
// if the color exists as a preset
|
|
||||||
if (Discord.Color[colorName]) {
|
|
||||||
|
|
||||||
// update the role with the new color
|
|
||||||
bot.updateRole(role, {
|
|
||||||
color: Discord.Color[colorName]
|
|
||||||
}).then(function (role) {
|
|
||||||
// this executes if the change was correct
|
|
||||||
bot.reply(msg, "done! using the color " + Discord.Color.toHex(role.color));
|
|
||||||
});
|
|
||||||
|
|
||||||
} else {
|
|
||||||
bot.reply(msg, "that color isn't a preset color!");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (msg.content.indexOf("custom color") === 0) {
|
|
||||||
|
|
||||||
// valid custom colors must follow the format of any of the following:
|
// valid custom colors must follow the format of any of the following:
|
||||||
/*
|
/*
|
||||||
@@ -79,27 +51,23 @@ bot.on("message", function (msg) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
var colorName = msg.content.split(" ")[2];
|
var colorName = msg.content.split(" ")[2];
|
||||||
|
|
||||||
// get the role by its name
|
// get the role by its name
|
||||||
var role = msg.channel.server.getRole("name", "Custom Colors");
|
var role = msg.server.roles.get("name", "Custom Colors");
|
||||||
|
|
||||||
// updates the role with the given color
|
// updates the role with the given color
|
||||||
bot.updateRole(role, {
|
bot.updateRole(role, {
|
||||||
color: colorName
|
color: colorName
|
||||||
}).then(function (role) {
|
}).then(function (role) {
|
||||||
|
|
||||||
// this executes if the change was successful
|
// this executes if the change was successful
|
||||||
bot.reply(msg, "done! using the color " + Discord.Color.toHex(role.color));
|
bot.reply(msg, "Done! Using the color " + colorName);
|
||||||
|
|
||||||
}).catch(function (e) {
|
}).catch(function (e) {
|
||||||
|
|
||||||
// this executes if it wasn't successful
|
// this executes if it wasn't successful
|
||||||
bot.reply(msg, "an error occurred. Was that a valid hex/dec color?");
|
bot.reply(msg, "An error occurred. Was that a valid hex/dec color?");
|
||||||
|
});
|
||||||
})
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
bot.login(AuthDetails.email, AuthDetails.password);
|
bot.loginWithToken(AuthDetails.token);
|
||||||
@@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
var Discord = require("../../");
|
var Discord = require("../../");
|
||||||
|
|
||||||
Discord.patchStrings();
|
|
||||||
|
|
||||||
var AuthDetails = require("../auth.json");
|
var AuthDetails = require("../auth.json");
|
||||||
|
|
||||||
var bot = new Discord.Client();
|
var bot = new Discord.Client();
|
||||||
@@ -13,38 +11,36 @@ bot.on("ready", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
bot.on("message", (msg) => {
|
bot.on("message", (msg) => {
|
||||||
|
var user = msg.author;
|
||||||
|
|
||||||
if(msg.content === "can I tts?"){
|
if(msg.content === "can I tts?"){
|
||||||
|
|
||||||
var user = msg.sender;
|
|
||||||
|
|
||||||
// get the evaluated permissions for a user in the channel they asked
|
// get the evaluated permissions for a user in the channel they asked
|
||||||
var permissions = msg.channel.permissionsOf(user);
|
var permissions = msg.channel.permissionsOf(user);
|
||||||
|
|
||||||
if(permissions.sendTTSMessages){
|
if(permissions.sendTTSMessages)
|
||||||
bot.reply(msg, "You " + "can".italic.bold + " send TTS messages.");
|
bot.reply(msg, "You ***can*** send TTS messages.");
|
||||||
}else{
|
|
||||||
bot.reply(msg, "You " + "can't".italic.bold + " send TTS messages.");
|
else
|
||||||
}
|
bot.reply(msg, "You ***can't*** send TTS messages.");
|
||||||
|
|
||||||
}else if(msg.content === "what are my full permissions?"){
|
|
||||||
|
} else if(msg.content === "what are my full permissions?") {
|
||||||
var user = msg.sender;
|
|
||||||
|
|
||||||
// get the serialised permissions of the user
|
// get the serialised permissions of the user
|
||||||
var permissions = msg.channel.permissionsOf(user).serialise();
|
var permissions = msg.channel.permissionsOf(user).serialise();
|
||||||
|
|
||||||
// if you want to stringify permissions, they need to be serialised first.
|
// if you want to stringify permissions, they need to be serialised first.
|
||||||
|
|
||||||
bot.reply(msg, JSON.stringify(permissions, null, 4).replace(/true/g, "**true**"));
|
bot.reply(msg, JSON.stringify(permissions, null, 4).replace(/true/g, "**true**"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
for a list of more permissions, go to
|
for a list of more permissions, go to
|
||||||
https://github.com/hydrabolt/discord.js/blob/master/src/EvaluatedPermissions.js
|
http://discordjs.readthedocs.io/en/indev/docs_permissionconstants.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
bot.login(AuthDetails.email, AuthDetails.password);
|
bot.loginWithToken(AuthDetails.token);
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
this bot is a ping pong bot, and every time a message
|
This bot is a ping pong bot, and every time a message
|
||||||
beginning with "ping" is sent, it will reply with
|
beginning with "ping" is sent, it will reply with
|
||||||
"pong!".
|
"pong!".
|
||||||
*/
|
*/
|
||||||
@@ -12,12 +12,12 @@ var AuthDetails = require("./auth.json");
|
|||||||
var bot = new Discord.Client();
|
var bot = new Discord.Client();
|
||||||
|
|
||||||
//when the bot is ready
|
//when the bot is ready
|
||||||
bot.on("ready", function () {
|
bot.on("ready", () => {
|
||||||
console.log("Ready to begin! Serving in " + bot.channels.length + " channels");
|
console.log(`Ready to begin! Serving in ${bot.channels.length} channels`);
|
||||||
});
|
});
|
||||||
|
|
||||||
//when the bot disconnects
|
//when the bot disconnects
|
||||||
bot.on("disconnected", function () {
|
bot.on("disconnected", () => {
|
||||||
//alert the console
|
//alert the console
|
||||||
console.log("Disconnected!");
|
console.log("Disconnected!");
|
||||||
|
|
||||||
@@ -26,15 +26,15 @@ bot.on("disconnected", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
//when the bot receives a message
|
//when the bot receives a message
|
||||||
bot.on("message", function (msg) {
|
bot.on("message", msg => {
|
||||||
//if message begins with "ping"
|
//if message begins with "ping"
|
||||||
if (msg.content.indexOf("ping") === 0) {
|
if (msg.content.startsWith("ping")) {
|
||||||
//send a message to the channel the ping message was sent in.
|
//send a message to the channel the ping message was sent in.
|
||||||
bot.sendMessage(msg.channel, "pong!");
|
bot.sendMessage(msg, "pong!");
|
||||||
|
|
||||||
//alert the console
|
//alert the console
|
||||||
console.log("pong-ed " + msg.author.username);
|
console.log("pong-ed " + msg.author.username);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
bot.login(AuthDetails.email, AuthDetails.password);
|
bot.loginWithToken(AuthDetails.token);
|
||||||
@@ -13,21 +13,18 @@ bot.on("ready", () => {
|
|||||||
bot.on("message", (msg) => {
|
bot.on("message", (msg) => {
|
||||||
|
|
||||||
if (msg.content === "photos") {
|
if (msg.content === "photos") {
|
||||||
|
bot.sendFile(msg, "./test/image.png", "photo.png", (err, sentMessage) => {
|
||||||
bot.sendFile( msg.channel, "./test/image.png", "photo.png", (err, msg) => {
|
if (err)
|
||||||
if(err)
|
console.log("Couldn't send image: ", err);
|
||||||
console.log("couldn't send image:", err);
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if( msg.content === "file" ) {
|
|
||||||
bot.sendFile( msg.channel, new Buffer("Text in a file!"), "file.txt", (err, msg) => {
|
|
||||||
if(err)
|
|
||||||
console.log("couldn't send file:", err);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
else if (msg.content === "file") {
|
||||||
|
bot.sendFile(msg.channel, new Buffer("Text in a file!"), "file.txt", (err, sentMessage) => {
|
||||||
|
if (err)
|
||||||
|
console.log("Couldn't send file: ", err)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
bot.login(AuthDetails.email, AuthDetails.password);
|
bot.loginWithToken(AuthDetails.token);
|
||||||
Reference in New Issue
Block a user