added command argument usage for sendlog (mobile support)

This commit is contained in:
ayeuhugyu 2023-09-24 10:53:21 -07:00
parent b52b23d495
commit ba443111c8
17 changed files with 53 additions and 21 deletions

View file

@ -18,6 +18,7 @@ clean up p/vileimagery, its horrendous
**_Note:_** _versions before this were not uploaded to the repo, this is not the first version._ **_Note:_** _versions before this were not uploaded to the repo, this is not the first version._
1.9 - added p/eulogy and the capability for command arguments 1.9 - added p/eulogy and the capability for command arguments
1.9.1 - added command argument usage for sendlog (mobile support)
--- ---

View file

@ -14,6 +14,7 @@ module.exports = {
name: "addguildmember", name: "addguildmember",
description: description:
"manually adds a guild member to the members list, whitelist required", "manually adds a guild member to the members list, whitelist required",
arguments: "none",
execute(message, args) { execute(message, args) {
if (whitelist.includes(message.author.id)) { if (whitelist.includes(message.author.id)) {
if (message.author.bot) return; if (message.author.bot) return;

View file

@ -2,7 +2,8 @@ const { EmbedBuilder } = require("discord.js");
const fs = require("fs"); const fs = require("fs");
module.exports = { module.exports = {
name: "commands", name: "commands",
description: "commands list", description: "displays commands list",
arguments: "none",
execute(message, args) { execute(message, args) {
let text = ""; let text = "";
@ -11,7 +12,7 @@ module.exports = {
.filter((file) => file.endsWith(".js")); .filter((file) => file.endsWith(".js"));
for (const file of commandFiles) { for (const file of commandFiles) {
const command = require(`./${file}`); const command = require(`./${file}`);
text += `p/${command.name} - ${command.description}\n`; text += `p/${command.name} - ${command.description} - command arguments: ${command.arguments}\n \n`;
} }
const embed = new EmbedBuilder(); const embed = new EmbedBuilder();

View file

@ -4,6 +4,7 @@ const fs = require("fs");
module.exports = { module.exports = {
name: "crash", name: "crash",
description: "crashes the bot (throws an error), requires whitelist", description: "crashes the bot (throws an error), requires whitelist",
arguments: "none",
execute(message, args) { execute(message, args) {
if (whitelist.includes(message.author.id)) { if (whitelist.includes(message.author.id)) {
message.reply("crashing bot..."); message.reply("crashing bot...");

View file

@ -60,6 +60,7 @@ const whitelist = ["440163494529073152", "436321340304392222"];
module.exports = { module.exports = {
name: "createreactionrole", name: "createreactionrole",
description: "creates reaction role, requires whitelist", description: "creates reaction role, requires whitelist",
arguments: "emoji, user",
execute(message, args) { execute(message, args) {
if (whitelist.includes(message.author.id)) { if (whitelist.includes(message.author.id)) {
let emojis = getEmojis(message); let emojis = getEmojis(message);

View file

@ -11,6 +11,7 @@ function delay(time) {
module.exports = { module.exports = {
name: "dmuser", name: "dmuser",
description: "forces bot to dm a user something (this will ghost ping them)", description: "forces bot to dm a user something (this will ghost ping them)",
arguments: "user, message",
execute(message, args) { execute(message, args) {
const user = message.mentions.users.first(); const user = message.mentions.users.first();
const guild = message.guild; const guild = message.guild;

View file

@ -6,6 +6,7 @@ const prefix = process.env.PREFIX;
module.exports = { module.exports = {
name: "eulogy", name: "eulogy",
description: "generates a eulogy", description: "generates a eulogy",
arguments: "name",
execute(message, args) { execute(message, args) {
const msgnoprefix = message.content.slice(prefix.length + this.name.length); const msgnoprefix = message.content.slice(prefix.length + this.name.length);
const name = msgnoprefix.slice(0, 2000); const name = msgnoprefix.slice(0, 2000);

View file

@ -2,6 +2,7 @@ module.exports = {
name: "guildmembers", name: "guildmembers",
description: description:
"sends a file including all past guild members (may not be accurrate, is mostly manually updated) -- note: also includes allies", "sends a file including all past guild members (may not be accurrate, is mostly manually updated) -- note: also includes allies",
arguments: "none",
execute(message, args) { execute(message, args) {
const path = `../pepperbot/data/guildmembers.log`; const path = `../pepperbot/data/guildmembers.log`;
message.channel.send({ message.channel.send({

View file

@ -2,6 +2,7 @@ const { EmbedBuilder } = require("discord.js");
module.exports = { module.exports = {
name: "links", name: "links",
description: 'posts "important" links', description: 'posts "important" links',
arguments: "none",
execute(message, args) { execute(message, args) {
const embed = new EmbedBuilder(); const embed = new EmbedBuilder();
embed.setTitle("very imphortance linkers"); embed.setTitle("very imphortance linkers");

View file

@ -1,7 +1,10 @@
module.exports = { module.exports = {
name: 'mymovie', name: "mymovie",
description: 'posts my movie', description: "posts my movie",
execute(message, args){ arguments: "none",
message.reply('https://cdn.discordapp.com/attachments/755150633191080073/1149158052784775219/My_Movie.mp4') execute(message, args) {
} message.reply(
} "https://cdn.discordapp.com/attachments/755150633191080073/1149158052784775219/My_Movie.mp4"
);
},
};

View file

@ -1,6 +1,7 @@
module.exports = { module.exports = {
name: "openpepper", name: "openpepper",
description: "posts open pepper repo", description: "posts open pepper repo",
arguments: "none",
execute(message, args) { execute(message, args) {
message.reply("https://git.reidlab.online/ayeuhugyu/OpenPepper"); message.reply("https://git.reidlab.online/ayeuhugyu/OpenPepper");
}, },

View file

@ -4,6 +4,7 @@ const fs = require("fs");
module.exports = { module.exports = {
name: "pepper", name: "pepper",
description: "RPG (random pepper generator)", description: "RPG (random pepper generator)",
arguments: "none",
execute(message, args) { execute(message, args) {
const peppers = fs.readdirSync("../pepperbot/resources/peppers"); const peppers = fs.readdirSync("../pepperbot/resources/peppers");
const maxRan = peppers.length; const maxRan = peppers.length;

View file

@ -11,6 +11,7 @@ function delay(time) {
module.exports = { module.exports = {
name: "say", name: "say",
description: "forces bot to say something", description: "forces bot to say something",
arguments: "message",
execute(message, args) { execute(message, args) {
if (message.author.bot) return; if (message.author.bot) return;
const msgnoprefix = message.content.slice(prefix.length + this.name.length); const msgnoprefix = message.content.slice(prefix.length + this.name.length);

View file

@ -1,15 +1,22 @@
const { Options } = require("discord.js");
const { Collection } = require("discord.js"); const { Collection } = require("discord.js");
const prefix = process.env.PREFIX; const prefix = process.env.PREFIX;
const ignore = []; const ignore = ["console.log"];
const fs = require("fs"); const fs = require("fs");
module.exports = { module.exports = {
name: "sendlog", name: "sendlog",
description: "sends log file (if the file is valid)", description: "sends log file (if the file is valid)",
arguments: "m, mobile",
execute(message, args) { execute(message, args) {
let msgnoprefix = message.content.slice( let mobileMode = false;
prefix.length + this.name.length + 1 if (args.includes("m") || args.includes("mobile")) {
); mobileMode = true;
}
//let msgnoprefix = message.content.slice(
//prefix.length + this.name.length + 1,
//);
let msgnoprefix = args[0];
if (!msgnoprefix.endsWith(".log")) { if (!msgnoprefix.endsWith(".log")) {
msgnoprefix += ".log"; msgnoprefix += ".log";
} }
@ -23,6 +30,7 @@ module.exports = {
} }
if (ignore.includes(msgnoprefix)) return; if (ignore.includes(msgnoprefix)) return;
const path = `../pepperbot/logs/${msgnoprefix}`; const path = `../pepperbot/logs/${msgnoprefix}`;
if (!mobileMode) {
message.channel.send({ message.channel.send({
files: [ files: [
{ {
@ -31,5 +39,12 @@ module.exports = {
}, },
], ],
}); });
} else {
const filestring = fs.readFileSync(path, "utf8");
console.log(typeof filestring);
message.channel.send(
filestring.slice(filestring.length - 500, filestring.length)
);
}
}, },
}; };

View file

@ -3,6 +3,7 @@ const log = require("../util/log.js").execute;
module.exports = { module.exports = {
name: "test", name: "test",
description: "test command", description: "test command",
arguments: "all",
execute(message, args) { execute(message, args) {
let text = let text =
"command arguments test \nthis list should include all arguments you included in the command \n"; "command arguments test \nthis list should include all arguments you included in the command \n";

View file

@ -5,6 +5,7 @@ const prefix = process.env.PREFIX;
module.exports = { module.exports = {
name: "vileimagery", name: "vileimagery",
description: "Do NOT run.", description: "Do NOT run.",
arguments: "file name",
execute(message, args) { execute(message, args) {
let proposedfilename = message.content.slice( let proposedfilename = message.content.slice(
prefix.length + this.name.length + 1 prefix.length + this.name.length + 1

View file

@ -60,7 +60,7 @@ module.exports.execute = function (message, client) {
"commands.log", "commands.log",
message, message,
__filename, __filename,
`use of command: ${command} by: ${message.author.username} (${message.author})"`, `use of command: ${command} by: ${message.author.username} (\`${message.author}\`)"`,
true true
); );
commands.get(command).execute(message, args, client); commands.get(command).execute(message, args, client);