Skip to content

Commit

Permalink
Auto fixing lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherBThai committed Jan 10, 2023
1 parent a8fd145 commit 1fc71a2
Show file tree
Hide file tree
Showing 163 changed files with 2,112 additions and 2,115 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const config = require('./src/data/config.json');

// Grab tokens and secret files
const debug = config.debug;
if (!debug) var tracer = require('dd-trace').init();
if (!debug) require('dd-trace').init();

const request = require('./utils/request.js');
// Eris-Sharder
Expand All @@ -29,7 +29,7 @@ var result, shards, firstShardID, lastShardID;
// Helper files
if (require('cluster').isMaster) {
const global = require('./utils/global.js');
const RamCheck = new (require('./utils/ramCheck.js'))(global);
new (require('./utils/ramCheck.js'))(global);
}

let clusters = 60;
Expand All @@ -56,7 +56,7 @@ let clusters = 60;
);

// Start sharder
const sharder = new Sharder('Bot ' + process.env.BOT_TOKEN, config.sharder.path, {
new Sharder('Bot ' + process.env.BOT_TOKEN, config.sharder.path, {
name: config.sharder.name,
clientOptions: config.eris.clientOptions,
debug: true,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "index.js",
"scripts": {
"lint": "npx eslint .",
"lint:fix": "npx eslint --fix",
"lint:fix": "npx eslint --fix .",
"prettier": "npx prettier --check .",
"prettier:fix": "npx prettier --write .",
"format": "npm run lint:fix && npm run prettier:fix"
Expand Down
2 changes: 2 additions & 0 deletions secret/macro.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint no-use-before-define: 0 */

// Checks for macros
exports.check = async function (p, command, { diff, now }) {
return true;
Expand Down
2 changes: 1 addition & 1 deletion src/botHandlers/mysqlHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ exports.startTransaction = () => {
delete result.rollback;
delete result.query;
clearTimeout(releaseTimer);
return new Promise((res, rej) => {
return new Promise((res) => {
acon.rollback(() => {
acon.release();
res();
Expand Down
13 changes: 4 additions & 9 deletions src/botHandlers/questHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@
const quests = require('../data/quests.json');
const mysql = require('./mysqlHandler.js');
const global = require('../utils/global.js');
const findQuest = {
rare: ['common', 'uncommon'],
epic: ['common', 'uncommon', 'rare'],
mythical: ['common', 'uncommon', 'rare', 'epic'],
};
const questBy = ['friendlyBattle', 'friendlyBattleBy', 'emoteBy', 'prayBy', 'curseBy', 'cookieBy'];

module.exports = class Quest {
Expand Down Expand Up @@ -72,7 +67,7 @@ async function check(msg, id, username, questName, result, count, extra) {
}

/* Check if the quest is complete */
let text, rewardSql, sqls, variables, rewardVar;
let text, rewardSql, sql, variables, rewardVar;
if (current >= needed) {
sql =
'DELETE FROM quest WHERE qid = ? AND qname = ? AND uid = (SELECT uid FROM user WHERE id = ?);';
Expand All @@ -82,16 +77,16 @@ async function check(msg, id, username, questName, result, count, extra) {
if (rewardType == 'lootbox') {
text += '<:box:427352600476647425>'.repeat(reward);
rewardSql =
"INSERT INTO lootbox (id,boxcount,claim) VALUES (?,?,'2017-01-01 10:10:10') ON DUPLICATE KEY UPDATE boxcount = boxcount + ?;";
'INSERT INTO lootbox (id,boxcount,claim) VALUES (?,?,\'2017-01-01 10:10:10\') ON DUPLICATE KEY UPDATE boxcount = boxcount + ?;';
rewardVar = [id, reward, reward];
} else if (rewardType == 'crate') {
text += '<:crate:523771259302182922>'.repeat(reward);
rewardSql =
"INSERT INTO crate (uid,boxcount,claim) VALUES ((SELECT uid FROM user WHERE id = ?),?,'2017-01-01 10:10:10') ON DUPLICATE KEY UPDATE boxcount = boxcount + ?;";
'INSERT INTO crate (uid,boxcount,claim) VALUES ((SELECT uid FROM user WHERE id = ?),?,\'2017-01-01 10:10:10\') ON DUPLICATE KEY UPDATE boxcount = boxcount + ?;';
rewardVar = [id, reward, reward];
} else if (rewardType == 'shards') {
text += '<:weaponshard:655902978712272917>**x' + reward + '**';
rewardSql = `INSERT INTO shards (uid,count) VALUES ((SELECT uid FROM user WHERE id = ?),?) ON DUPLICATE KEY UPDATE count = count + ?;`;
rewardSql = 'INSERT INTO shards (uid,count) VALUES ((SELECT uid FROM user WHERE id = ?),?) ON DUPLICATE KEY UPDATE count = count + ?;';
rewardVar = [id, reward, reward];
} else {
text += global.toFancyNum(reward) + ' <:cowoncy:416043450337853441>';
Expand Down
2 changes: 1 addition & 1 deletion src/commands/CommandInterface.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module.exports = class CommandInterface {
'` 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;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/commands/command.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Command {

async execute(msg, raw) {
// Parse content info
let { args, context } = await checkPrefix(this.main, msg) || {};
let { args, context } = (await checkPrefix(this.main, msg)) || {};
const containsPoints =
msg.content.toLowerCase().includes('owo') || msg.content.toLowerCase().includes('uwu');
if (!args) {
Expand Down Expand Up @@ -86,7 +86,7 @@ class Command {
if (msg.content.toLowerCase().indexOf(this.prefix) !== 0) {
return false;
}
let { args, context } = await checkPrefix(this.main, msg) || {};
let { args, context } = (await checkPrefix(this.main, msg)) || {};
let command = args.shift().toLowerCase();
let commandObj = adminCommands[command];
if (!commandObj) {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/commandList/admin/adminProfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = new CommandInterface({
let user = p.args[0].match(/[0-9]+/)[0];
user = await p.fetch.getUser(user);
if (!user) {
p.errorMsg(", I couldn't find that user!", 3000);
p.errorMsg(', I couldn\'t find that user!', 3000);
} else {
await profileUtil.displayProfile(p, user);
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/commandList/admin/getPatreonRewards.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ async function getPatreons(p) {
console.log(patreons);
let result = [];
if (p.args[0] != 'ignoresql') {
let sql = `SELECT id FROM user INNER JOIN patreons ON user.uid = patreons.uid WHERE TIMESTAMPDIFF(MONTH,patreonTimer,NOW())<patreonMonths;`;
let sql = 'SELECT id FROM user INNER JOIN patreons ON user.uid = patreons.uid WHERE TIMESTAMPDIFF(MONTH,patreonTimer,NOW())<patreonMonths;';
result = await p.query(sql);
}

Expand Down
18 changes: 9 additions & 9 deletions src/commands/commandList/admin/givePerkTicket.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ async function giveTicket(p, id, count = 1, type = 1) {
}
let name, emoji;
switch (type) {
case 1:
type = 'common_tickets';
name = 'Common Ticket';
if (Math.abs(count) > 1) name += 's';
emoji = p.config.emoji.perkTicket.common;
break;
default:
p.errorMsg(', wrong ticket type for ' + id);
return;
case 1:
type = 'common_tickets';
name = 'Common Ticket';
if (Math.abs(count) > 1) name += 's';
emoji = p.config.emoji.perkTicket.common;
break;
default:
p.errorMsg(', wrong ticket type for ' + id);
return;
}

// Fetch uid first
Expand Down
2 changes: 1 addition & 1 deletion src/commands/commandList/admin/lift.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module.exports = new CommandInterface({
))
) {
if (user.dmError) {
p.send('⚠ **|** Penalty has been set to 0 for ' + user.username + ", I couldn't DM them.");
p.send('⚠ **|** Penalty has been set to 0 for ' + user.username + ', I couldn\'t DM them.');
} else {
p.send('Penalty has been set to 0 for ' + user.username);
}
Expand Down
4 changes: 2 additions & 2 deletions src/commands/commandList/admin/prayfrom.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ async function banList(p) {
} catch (e) {
p.replyMsg(
banEmoji,
', **' + username + '** and ' + (count - 1) + " users have been banned, I couldn't DM them."
', **' + username + '** and ' + (count - 1) + ' users have been banned, I couldn\'t DM them.'
);
return;
}
Expand Down Expand Up @@ -112,7 +112,7 @@ async function displayList(p) {
let result = await p.query(sql);

if (!result[0] || !result[0].count || result[0].count == 0) {
p.errorMsg(', ' + username + " hasn't prayed to anyone!", 3000);
p.errorMsg(', ' + username + ' hasn\'t prayed to anyone!', 3000);
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/commands/commandList/admin/prayto.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ async function banList(p) {
} catch (e) {
p.replyMsg(
banEmoji,
', **' + username + '** and ' + (count - 1) + " users have been banned, I couldn't DM them"
', **' + username + '** and ' + (count - 1) + ' users have been banned, I couldn\'t DM them'
);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/commandList/admin/resetCowoncy.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module.exports = new CommandInterface({
} **|** I couldn't DM them.`
);
} else {
p.send(`⚠ **|** Failed to reset cowoncy`);
p.send('⚠ **|** Failed to reset cowoncy');
}
},
});
2 changes: 1 addition & 1 deletion src/commands/commandList/admin/warn.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module.exports = new CommandInterface({
if (user && !user.dmError) {
p.send(`📨 **|** Sent a warning to **${user.username}#${user.discriminator}**`);
} else {
p.send(`⚠ **|** Failed to send a warning for that user`);
p.send('⚠ **|** Failed to send a warning for that user');
}
},
});
2 changes: 1 addition & 1 deletion src/commands/commandList/battle/ab.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ module.exports = new CommandInterface({
(SELECT * FROM (SELECT COUNT(id) FROM cowoncy c2 WHERE c2.id IN (${author.id},${sender.id}) AND c2.money >= ${bet}) c3) >= 2`;
result = await p.query(sql);
if (result.changedRows < 2) {
p.errorMsg(", looks like someone doesn't have enough money!", 3000);
p.errorMsg(', looks like someone doesn\'t have enough money!', 3000);
return;
}
sql = `UPDATE cowoncy SET money = money + ${bet * 2} WHERE id = ${winner.id}; ${winSql}`;
Expand Down
8 changes: 4 additions & 4 deletions src/commands/commandList/battle/battleSetting.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async function display(p) {
let embed = {
color: p.config.embed_color,
author: {
name: p.msg.author.username + "'s battle settings",
name: p.msg.author.username + '\'s battle settings',
icon_url: p.msg.author.avatarURL,
},
description: text,
Expand Down Expand Up @@ -82,11 +82,11 @@ async function changeSettings(p) {
}else*/ if (args[0] == 'display') {
field = 'display';
if (args[1] == 'image') {
setting = "'image'";
setting = '\'image\'';
} else if (args[1] == 'text') {
setting = "'text'";
setting = '\'text\'';
} else if (args[1] == 'compact') {
setting = "'compact'";
setting = '\'compact\'';
} else {
p.errorMsg(', the display settings can only be `image`, `compact`, or `text`!');
return;
Expand Down
4 changes: 2 additions & 2 deletions src/commands/commandList/battle/crate.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module.exports = new CommandInterface({
let sql = `SELECT boxcount FROM crate INNER JOIN user ON crate.uid = user.uid WHERE id = ${p.msg.author.id};`;
let result = await p.query(sql);
if (!result || result[0].boxcount <= 0) {
p.errorMsg(", you don't have any more weapon crates!");
p.errorMsg(', you don\'t have any more weapon crates!');
return;
}
let boxcount = result[0].boxcount;
Expand All @@ -68,7 +68,7 @@ async function openCrate(p, count = 1) {
let result = await p.query(sql);

if (result[0].changedRows == 0 || !result[1][0]) {
p.errorMsg(", You don't have any weapon crates!", 3000);
p.errorMsg(', You don\'t have any weapon crates!', 3000);
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/commands/commandList/battle/rename.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module.exports = new CommandInterface({
/* Validity check */
animal = p.global.validAnimal(animal);
if (!animal) {
return p.errorMsg(", I couldn't find that animal! D:");
return p.errorMsg(', I couldn\'t find that animal! D:');
}
if (input.length > 35) {
return p.errorMsg(', The nickname is too long!', 3000);
Expand Down
12 changes: 6 additions & 6 deletions src/commands/commandList/battle/team.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ module.exports = new CommandInterface({
/* No changing while in battle */
if (await battleUtil.inBattle(p))
p.errorMsg(
", You cannot change your team while you're in battle! Please finish your `owo battle`!",
', You cannot change your team while you\'re in battle! Please finish your `owo battle`!',
3000
);
else if (await battleFriendUtil.inBattle(p))
Expand All @@ -68,7 +68,7 @@ module.exports = new CommandInterface({
/* No changing while in battle */
if (await battleUtil.inBattle(p))
p.errorMsg(
", You cannot change your team while you're in battle! Please finish your `owo battle`!",
', You cannot change your team while you\'re in battle! Please finish your `owo battle`!',
3000
);
else if (await battleFriendUtil.inBattle(p))
Expand All @@ -95,7 +95,7 @@ async function displayTeam(p) {
await teamUtil.displayTeam(p);
} catch (err) {
console.error(err);
p.errorMsg(`, something went wrong... Try again!`, 5000);
p.errorMsg(', something went wrong... Try again!', 5000);
}
}

Expand Down Expand Up @@ -129,7 +129,7 @@ async function add(p) {
await teamUtil.addMember(p, animal, pos);
} catch (err) {
console.error(err);
p.errorMsg(`, something went wrong... Try again!`, 5000);
p.errorMsg(', something went wrong... Try again!', 5000);
}
}

Expand Down Expand Up @@ -162,7 +162,7 @@ async function remove(p) {
await teamUtil.removeMember(p, remove);
} catch (err) {
console.error(err);
p.errorMsg(`, something went wrong... Try again!`, 5000);
p.errorMsg(', something went wrong... Try again!', 5000);
}
}

Expand All @@ -183,6 +183,6 @@ async function rename(p) {
await teamUtil.renameTeam(p, name);
} catch (err) {
console.error(err);
p.errorMsg(`, something went wrong... Try again!`, 5000);
p.errorMsg(', something went wrong... Try again!', 5000);
}
}
14 changes: 7 additions & 7 deletions src/commands/commandList/battle/teams.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ async function displayTeams(p) {
let activeTeam = 0;
const teamsOrder = {};
if (!result[2].length) {
p.errorMsg(", you don't have a team! Create one with `owo team add {animalName}`!", 5000);
p.errorMsg(', you don\'t have a team! Create one with `owo team add {animalName}`!', 5000);
return;
}
// Find current active team
Expand All @@ -131,7 +131,7 @@ async function displayTeams(p) {
const embed = teamUtil.createTeamEmbed(p, team, other);
const teamOrder = teamsOrder[pgid];
if (teamOrder == null) {
p.errorMsg(", I couldn't parse your team... something went terribly wrong!", 3000);
p.errorMsg(', I couldn\'t parse your team... something went terribly wrong!', 3000);
return;
}
teams[teamOrder] = embed;
Expand All @@ -142,7 +142,7 @@ async function displayTeams(p) {
if (!teams[i]) {
teams[i] = {
author: {
name: p.msg.author.username + "'s team",
name: p.msg.author.username + '\'s team',
icon_url: p.msg.author.avatarURL,
},
description:
Expand Down Expand Up @@ -213,7 +213,7 @@ async function setTeam(p, teamNum, dontDisplay) {
// You cant change teams if in battle
if (await battleUtil.inBattle(p)) {
p.errorMsg(
", You cannot change your team while you're in battle! Please finish your `owo battle`!",
', You cannot change your team while you\'re in battle! Please finish your `owo battle`!',
3000
);
return;
Expand All @@ -228,12 +228,12 @@ async function setTeam(p, teamNum, dontDisplay) {
// Fetch uid and pgid
let sql = `SELECT uid FROM user WHERE id = ${p.msg.author.id};
SELECT pgid FROM user LEFT JOIN pet_team ON user.uid = pet_team.uid WHERE id = ${
p.msg.author.id
} ORDER BY pgid LIMIT 1 OFFSET ${teamNum - 1}`;
p.msg.author.id
} ORDER BY pgid LIMIT 1 OFFSET ${teamNum - 1}`;
let result = await p.query(sql);

if (!result[0]) {
p.errorMsg(", you don't have any animals! Get some with `owo hunt`!", 3000);
p.errorMsg(', you don\'t have any animals! Get some with `owo hunt`!', 3000);
return;
}

Expand Down
Loading

0 comments on commit 1fc71a2

Please sign in to comment.