Pepperbot initializing
This commit is contained in:
commit
18c5085262
20 changed files with 2762 additions and 0 deletions
65
src/commands/dmuser.js
Normal file
65
src/commands/dmuser.js
Normal file
|
@ -0,0 +1,65 @@
|
|||
const fs = require("fs");
|
||||
|
||||
const prefix = process.env.PREFIX;
|
||||
|
||||
function delay(time) {
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(resolve, time);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
name: "dmuser",
|
||||
description: "forces bot to dm a user something (this will ghost ping them)",
|
||||
execute(message, args, client) {
|
||||
const user = message.mentions.users.first();
|
||||
if (!user) {
|
||||
return;
|
||||
}
|
||||
const msgnoprefix = message.content.slice(
|
||||
prefix.length + this.name.length + user.id.length + 4
|
||||
);
|
||||
|
||||
console.log(typeof user);
|
||||
console.log(user.username);
|
||||
//const usercache = client.users.fetch(user.id, false, true);
|
||||
|
||||
const msg = msgnoprefix.slice(0, 2000);
|
||||
|
||||
if (msg !== "") {
|
||||
user.send(msg);
|
||||
message.delete();
|
||||
fs.appendFileSync(
|
||||
"../pepperbot/src/logs/forcesay.log",
|
||||
Date() +
|
||||
" " +
|
||||
message.author.username +
|
||||
" (" +
|
||||
message.author +
|
||||
") forced bot to dm " +
|
||||
user.username +
|
||||
msg +
|
||||
"\n",
|
||||
(err) => {
|
||||
if (err !== null) {
|
||||
console.error(err);
|
||||
fs.appendFileSync(
|
||||
"../pepperbot/src/logs/errors.log",
|
||||
err + " from: " + message.content + " at " + Date()
|
||||
);
|
||||
}
|
||||
}
|
||||
);
|
||||
console.log(
|
||||
Date() +
|
||||
message.author.username +
|
||||
" (" +
|
||||
message.author +
|
||||
") forced bot to dm " +
|
||||
user.username +
|
||||
msg +
|
||||
"\n"
|
||||
);
|
||||
}
|
||||
},
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue