Skip to content

Commit

Permalink
prettier changed max length to 100
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher Thai committed Jan 1, 2023
1 parent 2fcd1a4 commit 120ec2e
Show file tree
Hide file tree
Showing 251 changed files with 1,341 additions and 3,983 deletions.
3 changes: 2 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"trailingComma": "es5",
"useTabs": true,
"semi": true,
"singleQuote": true
"singleQuote": true,
"printWidth": 100
}
38 changes: 12 additions & 26 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,10 @@
*/
require('dotenv').config();
if (!process.env.BOT_TOKEN) {
console.error(
'Bot token not found in ~/.env file. Checking secret file instead...'
);
console.error('Bot token not found in ~/.env file. Checking secret file instead...');
require('dotenv').config({ path: './secret/env' });
if (!process.env.BOT_TOKEN) {
console.error(
'No bot token found. Please edit ./secret/env file and add your token'
);
console.error('No bot token found. Please edit ./secret/env file and add your token');
return;
}
}
Expand Down Expand Up @@ -56,29 +52,19 @@ let clusters = 60;
}

console.log(
'Creating shards ' +
firstShardID +
'~' +
lastShardID +
' out of ' +
shards +
' total shards!'
'Creating shards ' + firstShardID + '~' + lastShardID + ' out of ' + shards + ' total shards!'
);

// Start sharder
const sharder = new Sharder(
'Bot ' + process.env.BOT_TOKEN,
config.sharder.path,
{
name: config.sharder.name,
clientOptions: config.eris.clientOptions,
debug: true,
shards,
clusters,
firstShardID,
lastShardID,
}
);
const sharder = new Sharder('Bot ' + process.env.BOT_TOKEN, config.sharder.path, {
name: config.sharder.name,
clientOptions: config.eris.clientOptions,
debug: true,
shards,
clusters,
firstShardID,
lastShardID,
});
} catch (e) {
console.error('Failed to start eris sharder');
console.error(e);
Expand Down
27 changes: 3 additions & 24 deletions secret/owo-animals.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,9 @@
{
"common": [0.588489, ":bee:", ":bug:", ":snail:", ":beetle:", ":butterfly:"],
"uncommon": [
0.888489,
":baby_chick:",
":mouse2:",
":rooster:",
":rabbit2:",
":chipmunk:"
],
"uncommon": [0.888489, ":baby_chick:", ":mouse2:", ":rooster:", ":rabbit2:", ":chipmunk:"],
"rare": [0.988489, ":sheep:", ":pig2:", ":cow2:", ":dog2:", ":cat2:"],
"epic": [
0.998489,
":crocodile:",
":tiger2:",
":penguin:",
":elephant:",
":whale:"
],
"mythical": [
0.999489,
":dragon:",
":unicorn:",
":snowman2:",
":ghost:",
":dove:"
],
"epic": [0.998489, ":crocodile:", ":tiger2:", ":penguin:", ":elephant:", ":whale:"],
"mythical": [0.999489, ":dragon:", ":unicorn:", ":snowman2:", ":ghost:", ":dove:"],
"legendary": [
0.999989,
"<a:gsquid:417968419984375808>",
Expand Down
9 changes: 1 addition & 8 deletions src/botHandlers/questHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,7 @@ const findQuest = {
epic: ['common', 'uncommon', 'rare'],
mythical: ['common', 'uncommon', 'rare', 'epic'],
};
const questBy = [
'friendlyBattle',
'friendlyBattleBy',
'emoteBy',
'prayBy',
'curseBy',
'cookieBy',
];
const questBy = ['friendlyBattle', 'friendlyBattleBy', 'emoteBy', 'prayBy', 'curseBy', 'cookieBy'];

module.exports = class Quest {
/* Constructer to grab mysql connection */
Expand Down
17 changes: 3 additions & 14 deletions src/commands/CommandInterface.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,33 +23,22 @@ module.exports = class CommandInterface {
let channelPerms = channel.permissionsOf(params.client.user.id);
for (let i in this.permissions) {
if (!channelPerms.has(this.permissions[i])) {
if (
channelPerms.has('sendMessages') &&
channelPerms.has('readMessages')
)
if (channelPerms.has('sendMessages') && channelPerms.has('readMessages'))
params.errorMsg(
', the bot does not have the `' +
this.permissions[i] +
'` permission! Please reinvite the bot, or contact your server admin!',
4000
);
params.logger.incr(
`noperms`,
1,
{ permission: this.permissions },
params.msg
);
params.logger.incr(`noperms`, 1, { permission: this.permissions }, params.msg);
return;
}
}
}

// Check if command is for nsfw only
if (this.nsfw && !params.msg.channel.nsfw) {
params.errorMsg(
', This command can only be used in **nsfw** channels!',
5000
);
params.errorMsg(', This command can only be used in **nsfw** channels!', 5000);
return;
}
await this.executeCommand.bind(params)(params);
Expand Down
25 changes: 6 additions & 19 deletions src/commands/command.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ class Command {
// Parse content info
let args = await checkPrefix(this.main, msg);
const containsPoints =
msg.content.toLowerCase().includes('owo') ||
msg.content.toLowerCase().includes('uwu');
msg.content.toLowerCase().includes('owo') || msg.content.toLowerCase().includes('uwu');
if (!args) {
//if user said owo/uwu
if (containsPoints) {
Expand Down Expand Up @@ -107,17 +106,13 @@ class Command {
return true;
} else if (
commandObj.manager &&
this.main.config.role.manager.find((id) =>
msg.member?.roles.includes(id)
)
this.main.config.role.manager.find((id) => msg.member?.roles.includes(id))
) {
adminCommands[command].execute(param);
return true;
} else if (
commandObj.helper &&
this.main.config.role.helper.find((id) =>
msg.member?.roles.includes(id)
)
this.main.config.role.helper.find((id) => msg.member?.roles.includes(id))
) {
adminCommands[command].execute(param);
return true;
Expand Down Expand Up @@ -291,9 +286,7 @@ function initParam(msg, command, args, main) {
EmojiAdder: main.EmojiAdder,
badwords: main.badwords,
quest: function (questName, count, extra) {
main.questHandler
.increment(msg, questName, count, extra)
.catch(console.error);
main.questHandler.increment(msg, questName, count, extra).catch(console.error);
},
reactionCollector: main.reactionCollector,
interactionCollector: main.interactionCollector,
Expand Down Expand Up @@ -359,14 +352,8 @@ async function checkPrefix(main, msg) {
}

// check with custom prefix
if (
msg.channel.guild.prefix &&
content.startsWith(msg.channel.guild.prefix)
) {
return msg.content
.slice(msg.channel.guild.prefix.length)
.trim()
.split(/ +/g);
if (msg.channel.guild.prefix && content.startsWith(msg.channel.guild.prefix)) {
return msg.content.slice(msg.channel.guild.prefix.length).trim().split(/ +/g);
}
}

Expand Down
11 changes: 3 additions & 8 deletions src/commands/commandList/admin/addPatreon.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ module.exports = new CommandInterface({
let { user, date } = await addPatreon(p, p.args[0], p.args[1], p.args[2]);
await p.replyMsg(
tada,
`, Updated **${
user.username + '#' + user.discriminator
}** patreon perks until **${date}**`
`, Updated **${user.username + '#' + user.discriminator}** patreon perks until **${date}**`
);
} else {
await addPatreons(p);
Expand Down Expand Up @@ -76,11 +74,8 @@ async function addPatreon(p, id, addMonths = 1, type = 1) {
let sql = `SELECT user.uid,patreonMonths,patreonTimer,TIMESTAMPDIFF(MONTH,patreonTimer,NOW()) AS monthsPassed,patreonType FROM user LEFT JOIN patreons ON user.uid = patreons.uid WHERE id = ${id}`;
let result = await p.query(sql);
let uid;
let months =
result[0] && result[0].patreonMonths ? result[0].patreonMonths : 0;
let monthsPassed = p.global.isInt(result[0]?.monthsPassed)
? result[0].monthsPassed
: months;
let months = result[0] && result[0].patreonMonths ? result[0].patreonMonths : 0;
let monthsPassed = p.global.isInt(result[0]?.monthsPassed) ? result[0].monthsPassed : months;
if (!type) {
if (result[0] && result[0].patreonType) type = result[0].patreonType;
else type = 1;
Expand Down
3 changes: 1 addition & 2 deletions src/commands/commandList/admin/ban.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ module.exports = new CommandInterface({
} else {
success.push(userObj);
}
else if ((guildObj = await p.fetch.getGuild(user, false)))
successGuild.push(guildObj);
else if ((guildObj = await p.fetch.getGuild(user, false))) successGuild.push(guildObj);
else failed.push(user);
} catch (e) {
failed.push(user);
Expand Down
4 changes: 1 addition & 3 deletions src/commands/commandList/admin/captcha.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ let captcha;
try {
captcha = require('../../../../../tokens/captcha.js');
} catch (err) {
console.error(
'Could not find captcha.js admin captcha command will not work'
);
console.error('Could not find captcha.js admin captcha command will not work');
}

module.exports = new CommandInterface({
Expand Down
9 changes: 3 additions & 6 deletions src/commands/commandList/admin/customPet.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ const CommandInterface = require('../../CommandInterface.js');

const config = require('./../../../data/config.json');
const embed = {
content:
'This is an automated message. All responses should go to <@184587051943985152>.',
content: 'This is an automated message. All responses should go to <@184587051943985152>.',
embed: {
color: config.embed_color,
timestamp: new Date(),
Expand All @@ -19,8 +18,7 @@ const embed = {
icon_url:
'https://cdn.discordapp.com/avatars/408785106942164992/7f7a07bfad0ad6a2faaaccd9421e5392.png?size=1024',
},
title:
'To redeem your pet, please DM **Scuttler#0001** with the info below!',
title: 'To redeem your pet, please DM **Scuttler#0001** with the info below!',
description: 'I will need these information below!\n```\n',
},
};
Expand All @@ -39,8 +37,7 @@ embed.embed.description +=
embed.embed.description +=
' - You can change the stats of the pet if you request it within 1 week of pet creation.\n';
embed.embed.description += ' - Once the pet is created, there is no refund.\n';
embed.embed.description +=
'\nIf you have any questions, please feel free to ask!\n';
embed.embed.description += '\nIf you have any questions, please feel free to ask!\n';
embed.embed.description +=
'\n⚠️**__DO NOT REPLY TO THIS DM. ALL MESSAGES SHOULD GO TO <@184587051943985152>__**⚠️';

Expand Down
20 changes: 4 additions & 16 deletions src/commands/commandList/admin/disableCaptcha.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,16 @@ module.exports = new CommandInterface({
} else if (changeLink) {
this.macro.setCaptchaLink(enableCaptcha);
if (enableCaptcha) {
this.replyMsg(
this.config.emoji.gear,
', I **enabled** `link` captchas'
);
this.replyMsg(this.config.emoji.gear, ', I **enabled** `link` captchas');
} else {
this.replyMsg(
this.config.emoji.gear,
', I **disabled** `link` captchas'
);
this.replyMsg(this.config.emoji.gear, ', I **disabled** `link` captchas');
}
} else if (changeImage) {
this.macro.setCaptchaImage(enableCaptcha);
if (enableCaptcha) {
this.replyMsg(
this.config.emoji.gear,
', I **enabled** `image` captchas'
);
this.replyMsg(this.config.emoji.gear, ', I **enabled** `image` captchas');
} else {
this.replyMsg(
this.config.emoji.gear,
', I **disabled** `image` captchas'
);
this.replyMsg(this.config.emoji.gear, ', I **disabled** `image` captchas');
}
}
},
Expand Down
38 changes: 5 additions & 33 deletions src/commands/commandList/admin/getPatreonRewards.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,7 @@ async function getPatreons(p) {
text += '**Customized Command**\n';
let list = patreons.customizedCommand;
for (let i in list) {
text +=
'<@' +
list[i].discord +
'> | **' +
list[i].name +
'** | ' +
list[i].discord +
'\n';
text += '<@' + list[i].discord + '> | **' + list[i].name + '** | ' + list[i].discord + '\n';
}
}

Expand All @@ -71,40 +64,19 @@ async function getPatreons(p) {
text += '\n**Custom Command**\n';
let list = patreons.customCommand;
for (let i in list) {
text +=
'<@' +
list[i].discord +
'> | **' +
list[i].name +
'** | ' +
list[i].discord +
'\n';
text += '<@' + list[i].discord + '> | **' + list[i].name + '** | ' + list[i].discord + '\n';
}
}

console.log('custom pet');
csv =
'Discord Name,Discord ID,Patreon Name,Pet Name,hp str pr wp mag mr,Pet Desc,Pet ID,SQL\n';
csv = 'Discord Name,Discord ID,Patreon Name,Pet Name,hp str pr wp mag mr,Pet Desc,Pet ID,SQL\n';
if (patreons.pet.length) {
text += '\n**Custom Pet**\n';
let list = patreons.pet;
for (let i in list) {
text +=
'<@' +
list[i].discord +
'> | **' +
list[i].name +
'** | ' +
list[i].discord +
'\n';
text += '<@' + list[i].discord + '> | **' + list[i].name + '** | ' + list[i].discord + '\n';
let user = await p.fetch.getUser(list[i].discord);
csv +=
(user ? user.username : 'A User') +
',' +
list[i].discord +
',' +
list[i].name +
'\n';
csv += (user ? user.username : 'A User') + ',' + list[i].discord + ',' + list[i].name + '\n';
}
}

Expand Down
4 changes: 1 addition & 3 deletions src/commands/commandList/admin/givePerkTicket.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,7 @@ async function giveTicket(p, id, count = 1, type = 1) {
else
user = await p.sender.msgUser(
id,
`${emoji} **|** Sorry about that. You have lost **${Math.abs(
count
)} ${emoji} ${name}**.`
`${emoji} **|** Sorry about that. You have lost **${Math.abs(count)} ${emoji} ${name}**.`
);

if (user && !user.dmError) return { user, count };
Expand Down
Loading

0 comments on commit 120ec2e

Please sign in to comment.