Modules take names from the name of their file

This commit is contained in:
Nathaniel Mason 2022-04-18 17:25:40 +01:00
parent 0de4408797
commit 74066f666e
26 changed files with 82 additions and 52 deletions

View File

@ -1,7 +1,9 @@
module.exports = {
name: '8ball',
name: require('path').parse(__filename).name,
description: 'Ask Anitrox a question, any question! and they will answer it!',
syntax: ["[Question]"],
async execute(client, message, args, config) {
const index = Math.floor(Math.random() * config.answers.length);
const answer = config.answers[index]

View File

@ -1,11 +1,11 @@
module.exports = {
name: "avatar",
name: require('path').parse(__filename).name,
description: "Gets a user's avatar.",
async execute(client, message, args, config) {
const user = message.mentions.users.first() || client.users.cache.get(args[0]) || message.author;
async execute(client, message, args, config) {
const user = message.mentions.users.first() || client.users.cache.get(args[0]) || message.author;
await message.channel.send({embed: {
"title": `:frame_photo: ${user.username}'s Beautiful Avatar!`,
"color": 9442302,

View File

@ -1,7 +1,8 @@
module.exports = {
name: "bonk",
name: require('path').parse(__filename).name,
description: "Bonks a user!",
async execute(client, message, _, config) {
const taggedUser = message.mentions.users.first();

View File

@ -1,8 +1,11 @@
module.exports = {
name: "cheese",
name: require('path').parse(__filename).name,
description: "Cheese an user, or run just ``n!cheese`` for a surprise :eyes:",
async execute(_0, message, _1, config) {
const taggedUser = message.mentions.users.first();
if(!taggedUser) {
await message.channel.send("*slams cheese on desk*\n**Cheese.** https://www.youtube.com/watch?v=Or4IE8fkpn4");
} else {

View File

@ -1,11 +1,13 @@
module.exports = {
name: 'choose',
name: require('path').parse(__filename).name,
description: "Give some lines of input, and get one back at random",
async execute(client, message, _, config) {
var strarr = message.content.split(/\s*\n\s*/);
strarr[0] = strarr[0].slice(this.name.length + config.prefix.length);
console.log(strarr);
const answer = strarr[Math.floor(Math.random() * strarr.length)];
if (answer === "") {
await message.channel.send(client.generateErrorMessage("You need to provide some input!", message.author.displayAvatarURL()));
} else {

View File

@ -7,10 +7,10 @@ const gifchoices = [
module.exports = {
name: "cuddle",
name: require('path').parse(__filename).name,
description: "Cuddle an user!",
async execute(client, message, _, config) {
async execute(client, message, _, config) {
const taggedUser = message.mentions.users.first();
const index = Math.floor(Math.random() * gifchoices.length);
const gif = (gifchoices[index]);

View File

@ -1,8 +1,10 @@
const { inspect } = require("util");
module.exports = {
name: 'eval',
name: require('path').parse(__filename).name,
description: 'Executes JS code',
async execute(_, message, args, config) {
if (message.author.id == config.ownerID) {
try {

View File

@ -1,6 +1,6 @@
module.exports = {
name: 'help',
name: require('path').parse(__filename).name,
description: 'Get help on anything from commands, to what the bot does! just not your homework..',
syntax: '<Command>',

View File

@ -8,8 +8,9 @@ const gifchoices = [
module.exports = {
name: "hug",
name: require('path').parse(__filename).name,
description: "Hugs a user!",
async execute(client, message, _, config) {
const taggedUser = message.mentions.users.first();

View File

@ -1,28 +1,29 @@
function Uptime(uptime) {
const totalSeconds = (uptime / 1000);
const days = parseInt(totalSeconds / 86400);
const hours = parseInt((totalSeconds % 86400) / 3600);
const minutes = parseInt((totalSeconds % 3600) / 60);
const seconds = parseInt(totalSeconds % 60);
const daystring = days + (days === 1 ? " day" : " days");
const hourstring = hours + (hours === 1 ? " hour" : " hours");
const minutetring = minutes + (minutes === 1 ? " minute" : " minutes");
const secondstring = seconds + (seconds === 1 ? " second" : " seconds");
return `${daystring}**, **${hourstring}**, **${minutetring}**, **${secondstring}`;
}
module.exports = {
name: 'info',
name: require('path').parse(__filename).name,
description: 'Shows bot and host information',
async execute(client, message, _, config) {
function Uptime(uptime) {
const totalSeconds = (uptime / 1000);
const days = parseInt(totalSeconds / 86400);
const hours = parseInt((totalSeconds % 86400) / 3600);
const minutes = parseInt((totalSeconds % 3600) / 60);
const seconds = parseInt(totalSeconds % 60);
const daystring = days + (days === 1 ? " day" : " days");
const hourstring = hours + (hours === 1 ? " hour" : " hours");
const minutetring = minutes + (minutes === 1 ? " minute" : " minutes");
const secondstring = seconds + (seconds === 1 ? " second" : " seconds");
return `${daystring}**, **${hourstring}**, **${minutetring}**, **${secondstring}`;
}
const os = require("os");
const osu = require('node-os-utils');
const cpu = osu.cpu;
await message.channel.send({embed: {
"title": "<:AnitroxInfo:809651936831733791> Information about Anitrox",
"description": "Everything you've ever wanted to know about your favorite bot, Anitrox!",

View File

@ -1,8 +1,9 @@
module.exports = {
name: 'invite',
name: require('path').parse(__filename).name,
description: 'Add Anitrox to your beautiful server!',
syntax: [],
async execute(_0, message, _1, config) {
await message.channel.send({embed: {
"title": "Add Anitrox to your Server!",

View File

@ -8,7 +8,7 @@ const gifchoices = [
module.exports = {
name: "kiss",
name: require('path').parse(__filename).name,
description: "Kisses a user!",
async execute(client, message, _, config) {
const taggedUser = message.mentions.users.first();

View File

@ -18,7 +18,7 @@ const gifchoices = [
module.exports = {
name: "leskiss",
name: require('path').parse(__filename).name,
description: "Lesbian kiss <:lesbian:803831629428686849>",
async execute(client, message, _, config) {
const taggedUser = message.mentions.users.first();

View File

@ -7,7 +7,7 @@ const gifchoices = [
module.exports = {
name: "lick",
name: require('path').parse(__filename).name,
description: "Licks a user!",
async execute(client, message, _, config) {
const taggedUser = message.mentions.users.first();

View File

@ -7,7 +7,7 @@ const gifchoices = [
module.exports = {
name: "nom",
name: require('path').parse(__filename).name,
description: "Noms an user!",
async execute(client, message, _, config) {
const taggedUser = message.mentions.users.first();

View File

@ -1,6 +1,8 @@
module.exports = {
name: 'opensource',
description: 'Attributions to open source components used by Anitrox',
name: require('path').parse(__filename).name,
description: 'Attributions to open source components used by Anitrox',
async execute(_0, message, _1, config){
await message.channel.send({embed: {
"title": "Component Attribution",

View File

@ -6,8 +6,9 @@ const gifchoices = [
module.exports = {
name: "pat",
name: require('path').parse(__filename).name,
description: "Pats a user!",
async execute(client, message, _, config) {
const taggedUser = message.mentions.users.first();

View File

@ -1,6 +1,8 @@
module.exports = {
name: "ping",
name: require('path').parse(__filename).name,
description: "Gets bot ping",
async execute(client, message, _, config) {
const index = Math.floor(Math.random() * config.locations.length);
const location = config.locations[index]

View File

@ -6,8 +6,9 @@ const gifchoices = [
module.exports = {
name: "poke",
name: require('path').parse(__filename).name,
description: "Pokes a user!",
async execute(client, message, _, config) {
const taggedUser = message.mentions.users.first();

View File

@ -1,6 +1,8 @@
module.exports = {
name: 'reload',
name: require('path').parse(__filename).name,
description: 'Reloads a command',
async execute(client, message, args, config) {
if (message.author.id = config.ownerID) {
if (!args.length) {

View File

@ -1,6 +1,8 @@
module.exports = {
name: 'restart',
name: require('path').parse(__filename).name,
description: 'Restarts the bot',
async execute(client, message, _, config) {
if (message.author.id == config.ownerID) {
console.log("Anitrox is restarting now!")

View File

@ -1,11 +1,11 @@
module.exports = {
name: 'setnick',
name: require('path').parse(__filename).name,
description: 'Sets your nickname',
async execute(client, message, args, config) {
if (message.channel.permissionsFor(message.author).has("CHANGE_NICKNAME")) {
const newnick = args.slice(0).join(" ")
try {
await message.member.setNickname(newnick, "Nickname change requested by the server member. If you don't want users to be able to change their nickname disable 'CHANGE_NICKNAME' via Change Nickname in Roles.")
await message.channel.send({embed: {

View File

@ -1,7 +1,8 @@
module.exports = {
name: "slap",
name: require('path').parse(__filename).name,
description: "Slaps an user!",
async execute(client, message, _, config) {
const taggedUser = message.mentions.users.first();

View File

@ -7,8 +7,9 @@ const gifchoices = [
module.exports = {
name: "snuggle",
name: require('path').parse(__filename).name,
description: "Snuggle an user!",
async execute(client, message, _, config) {
const taggedUser = message.mentions.users.first();

View File

@ -1,6 +1,8 @@
module.exports = {
name: "stop",
name: require('path').parse(__filename).name,
description: "IT'S TIME TO STOP!... the bot",
async execute(_0, message, _1, config) {
if (message.author.id == config.ownerID) {
await message.channel.send({embed: {

View File

@ -1,9 +1,12 @@
module.exports = {
name: "uinfo",
name: require('path').parse(__filename).name,
description: "Gets info about an user, such as ID, Discord Join date and more",
syntax: "<User>",
async execute(client, message, args, config) {
const user = message.mentions.users.first() || client.users.cache.get(args[0]) || message.author
await message.channel.send({embed: {
"title": `Everything you've ever wanted to know about ${user.username}!`,
"color": 9442302,