Skip to content
This repository has been archived by the owner on Jan 4, 2023. It is now read-only.

Commit

Permalink
Merge pull request #63 from Butterstroke/v1.3.4
Browse files Browse the repository at this point in the history
v1.3.4
  • Loading branch information
AurelicButter authored Jul 2, 2020
2 parents 33ebff8 + 3a586fa commit 94db282
Show file tree
Hide file tree
Showing 14 changed files with 69 additions and 36 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# MargarineBot - Version: Release 1.3.3
# MargarineBot
![License](https://img.shields.io/github/license/Butterstroke/MargarineBot.svg?style=flat-square) ![Support Server](https://discordapp.com/api/guilds/303253034551476225/widget.png)

<b>Dependencies</b>

![discord.js](https://img.shields.io/badge/discord.js-v12.2.0-brightgreen.svg) ![klasa](https://img.shields.io/badge/Klasa-v0.22.0-brightgreen.svg) ![node](https://img.shields.io/badge/Node-v12.0.0+-brightgreen.svg)
![discord.js](https://img.shields.io/badge/discord.js-v12.2.0-brightgreen.svg) ![klasa](https://img.shields.io/badge/Klasa-v0.5.0-brightgreen.svg) ![node](https://img.shields.io/badge/Node-v12.0.0+-brightgreen.svg)

A Discord bot coded in Node.js using the Discord.js Library and the Klasa framework.

Expand Down
13 changes: 12 additions & 1 deletion assets/localization.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
["Rewatching Occultic;Nine", "watch"],
["Rewatching Robotics;Notes", "watch"],
["Harvesting wild fruits", "play"],
["Fishing for a meal", "play"],
["Partying to weeb tunes", "listen"],
["Breaking all of the code", "play"],
["Spying on Butterstroke", "watch"],
Expand All @@ -19,6 +20,16 @@
["Someday, surely, for the sake of illuminating someone's path, I want to shine", "listen"],
["Considering the possibilities of being an isekai protagonist", "play"],
["Wakarimasen", "watch"],
["At the end of a certain world, what runs through is real force", "listen"]
["At the end of a certain world, what runs through is real force", "listen"],
["Creating books in another world", "play"],
["Becoming the hero of my world!", "play"],
["Reading manga", "play"],
["Watching anime", "watch"],
["Gaming the mainframe of the game", "play"],
["Spending thousands of dollars for PNGs... listen, it's worth it!", "play"],
["Time to tip the scales!", "play"],
["I challenge my fate!", "play"],
["Position zero!", "play"],
["Rewatching IDOLM@STER", "watch"]
]
}
4 changes: 2 additions & 2 deletions assets/settingsExample.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"token": "Token Key",
"prefix": "Prefix",
"build": {
"version": "Release 1.3.3",
"releaseDate": "June 18th, 2020"
"version": "Release 1.3.4",
"releaseDate": "July 2nd, 2020"
},
"database": "./assets/MargarineData.sqlite"
}
3 changes: 2 additions & 1 deletion assets/speech/en-CA/fun.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ module.exports = {
"You can't play rock, paper, scissors by yourself! At least invite me to play!"
],
"success": [
"-user1 plays -hand1! -user2 plays -hand2! **-result!**"
"-user1 plays -hand1! -user2 plays -hand2! **-result!**",
"-user1 reveals -hand1! -user2 reveals -hand2! **-result!**"
]
},
"poll": {
Expand Down
7 changes: 4 additions & 3 deletions commands/Economy/Cooking/sell.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@ module.exports = class extends Command {
}

async run(msg, [item=item.toLowerCase(), amount]) {
if (amount === 0) { return msg.sendLocale("DATACHECK_NOZERO"); }

const itemDB = this.client.itemData[item];
if (!itemDB) { return msg.sendLocale("DATACHECK_NOITEMS"); }

var data = this.client.dataManager("select", msg.author.id, "users");
if (!data) { return msg.sendLocale("DATACHECK_NOACCOUNT"); }

var itemData = this.client.dataManager("select", msg.author.id, itemDB.category);
if (!amount) { amount = itemData[item]; }
if (amount === 0 || !amount) { return msg.sendLocale("DATACHECK_NOZERO"); }
if (itemData[item] < amount) { return msg.channel.send(this.client.speech(msg, ["sell", "notEnough"])); }
if (!amount) { amount = itemData[item]; }
if (itemData[item] < amount) { return msg.sendLocale("SELL_NOTENOUGH", [msg]); }

this.client.dataManager("update", [`credits=${(data.credits + (itemDB.sell * amount))}`, msg.author.id], "users");
this.client.dataManager("update", [`${item}=${(itemData[item] - amount)}`, msg.author.id], itemDB.category);
Expand Down
2 changes: 1 addition & 1 deletion commands/Fun/Interactions/8ball.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ module.exports = class extends Command {
}

async run(msg) {
msg.channel.send(this.client.speech(msg, ["func-fun", "eightball"], [["-user", msg.author.username]]));
msg.sendLocale("EIGHTBALL", [msg, msg.author.username]);
}
};
2 changes: 1 addition & 1 deletion commands/Fun/Interactions/crash.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ module.exports = class extends Command {
}

async run(msg) {
msg.channel.send(this.client.speech(msg, ["func-fun", "crash"], [["-user", msg.author.username]]));
msg.sendLocale("CRASH", [msg, msg.author.username]);
}
};
4 changes: 2 additions & 2 deletions commands/Fun/Polling/endPoll.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ module.exports = class extends Command {
var title = pollData.info.split("|")[0],
desc = pollData.info.split("|")[1],
votes = JSON.parse(pollData.votes),
optionDisplay = ""
optionDisplay = "",
header = `The poll has ended!\n__${title}__\n${desc}\n\n`;

for (var x = 0; x < pollData.options.length; x++) {
optionDisplay = optionDisplay.concat(`${x + 1}) ${pollData.options[x]}: ${votes[x]}\n`);
}

msg.channel.send(optionDisplay);
msg.channel.send(header + optionDisplay);
msg.guild.settings.reset(["poll.info", "poll.options", "poll.votes", "poll.userVotes"]);
}
};
7 changes: 6 additions & 1 deletion commands/Fun/Polling/poll.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,12 @@ module.exports = class extends Command {
}

async end(msg) {
msg.channel.send(pollDisplay(msg.guild.settings.poll, true));
var pollData = msg.guild.settings.poll;

//No poll happening
if (!pollData.info) { return msg.sendLocale("POLL_NOPOLL", [msg]); }

msg.channel.send(pollDisplay(pollData, true));
msg.guild.settings.reset(["poll.info", "poll.options", "poll.votes", "poll.userVotes"]);
}

Expand Down
10 changes: 2 additions & 8 deletions commands/Fun/rps.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = class extends Command {

async run(msg, [choice, user]) {
if (!user) { user === this.client.user; }
if (user.id === msg.author.id) { return msg.channel.send(this.client.speech(msg, ["rps", "sameuser"])); }
if (user.id === msg.author.id) { return msg.sendLocale("RPS_SAMEUSER", [msg]); }

var types = ["rock", "paper", "scissors"];
var hand = types[Math.floor(Math.random() * (Math.floor(2) - Math.ceil(1) + 1)) + Math.ceil(1)];
Expand All @@ -24,12 +24,6 @@ module.exports = class extends Command {
else if ((choice === "rock" && hand === "paper") || (choice === "paper" && hand === "scissors") || (choice === "scissors" && hand === "rock")) { var result = `${user.username} wins`; }
else { var result = "Draw"; }

msg.channel.send(this.client.speech(msg, ["rps", "success"], [
["-user1", msg.author.username],
["-user2", user.username],
["-hand1", choice],
["-hand2", hand],
["-result", result]
]));
msg.sendLocale("RPS_SUCCESS", [msg, msg.author.username, user.username, choice, hand, result]);
}
};
35 changes: 25 additions & 10 deletions languages/en-CA.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@ module.exports = class extends Language {
COMMAND_RELOAD_ALL: (type, time) => `✅ Reloaded all ${type}. (Took: ${time})`,
COMMAND_RELOAD_EVERYTHING: (time) => `✅ Reloaded everything. (Took: ${time})`,
COMMAND_RELOAD_DESCRIPTION: 'Reloads a klasa piece, or all pieces of a klasa store.',
COMMAND_REBOOT: 'Rebooting...',
COMMAND_REBOOT_DESCRIPTION: 'Reboots the bot.',
COMMAND_ENABLE: (type, name) => `+ Successfully enabled ${type}: ${name}`,
COMMAND_ENABLE_DESCRIPTION: 'Re-enables or temporarily enables a command/inhibitor/monitor/finalizer. Default state restored on reboot.',
COMMAND_DISABLE: (type, name) => `+ Successfully disabled ${type}: ${name}`,
Expand Down Expand Up @@ -179,6 +177,12 @@ module.exports = class extends Language {
MUSICCHECK_NOQUEUE: this.client.speech(falseMsg, ["func-music", "general", "noQueue"]),
MUSICCHECK_MISMATCHVC: this.client.speech(falseMsg, ["func-music", "general", "mismatch"]),
MUSICCHECK_NOHANDLER: this.client.speech(falseMsg, ["func-music", "general", "noHandler"]),

/**
* Monitors
*/
PREFIXHELP_DEFAULT: (prefix) => `Whoops! Looks like you are thinking of my default prefix. That is not the case here. Please use: ${prefix}`,
PREFIXHELP_MISREAD: "Whoops! Looks like you misread my prefix. It's a tilde \`~\`, not a dash!",

/*
* Commands - Config
Expand Down Expand Up @@ -231,14 +235,24 @@ module.exports = class extends Language {
/*
* Commands - Fun
*/
EIGHTBALL: (msg, username) => this.client.speech(msg, ["func-fun", "eightball"], [["-user", username]]),
CRASH: (msg, username) => this.client.speech(msg, ["func-fun", "crash"], [["-user", username]]),
ROLL: (msg, value) => this.client.speech(msg, ["roll"], [["-value", value]]),
POLL_NOTITLE: (msg) => this.client.speech(msg, ["poll", "noTitle"]),
POLL_NODESC: (msg) => this.client.speech(msg, ["poll", "noDesc"]),
POLL_NOOPTIONS: (msg) => this.client.speech(msg, ["poll", "noChoice"]),
POLL_NOCREATE: (msg) => this.client.speech(msg, ["poll", "noCreate"]),
POLL_CREATED: (msg) => this.client.speech(msg, ["poll", "created"]),
POLL_VOTED: (msg, option) => this.client.speech(msg, ["poll", "voted"], [["-option", option]]),
POLL_NOPOLL: (msg) => this.client.speech(msg, ["poll", "noPoll"]),
POLL_NOTITLE: (msg) => this.client.speech(msg, ["func-fun", "poll", "noTitle"]),
POLL_NODESC: (msg) => this.client.speech(msg, ["func-fun", "poll", "noDesc"]),
POLL_NOOPTIONS: (msg) => this.client.speech(msg, ["func-fun", "poll", "noChoice"]),
POLL_NOCREATE: (msg) => this.client.speech(msg, ["func-fun", "poll", "noCreate"]),
POLL_CREATED: (msg) => this.client.speech(msg, ["func-fun", "poll", "created"]),
POLL_VOTED: (msg, option) => this.client.speech(msg, ["func-fun", "poll", "voted"], [["-option", option]]),
POLL_NOPOLL: (msg) => this.client.speech(msg, ["func-fun", "poll", "noPoll"]),
RPS_SAMEUSER: (msg) => this.client.speech(msg, ["rps", "sameUser"]),
RPS_SUCCESS: (msg, player1, player2, hand1, hand2, result) => this.client.speech(msg, ["rps", "success"], [
["-user1", player1],
["-user2", player2],
["-hand1", hand1],
["-hand2", hand2],
["-result", result]
]),

/*
* Commands - Economy
Expand Down Expand Up @@ -268,7 +282,8 @@ module.exports = class extends Language {
FISH: (msg, emote) => this.client.speech(msg, ["fish"], [["-kind", emote]]),
HARVEST: (msg, emote) => this.client.speech(msg, ["harvest"], [["-kind", emote]]),
CRAFT: (msg, amount, emote) => this.client.speech(msg, ["craft", "success"], [["-amount", amount], ["-item", emote]]),
SELL: (msg, emote, amount, price)=> this.client.speech(msg, ["sell", "success"], [["-item", emote], ["-amount", amount], ["-price", price]]),
SELL: (msg, emote, amount, price)=> this.client.speech(msg, ["sell", "success"], [["-item", emote], ["-amount", amount], ["-price", price]]),
SELL_NOTENOUGH: (msg) => this.client.speech(msg, ["sell", "notEnough"]),

/*
* Commands - Owner
Expand Down
10 changes: 8 additions & 2 deletions monitors/prefixHelp.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@ module.exports = class extends Monitor {

run(msg) {
var defaultPrefix = msg.client.gateways.guilds.schema.get("prefix").default;
var guildPrefix = msg.guild.settings.prefix;

if (msg.content === `${defaultPrefix}help`) {
if (defaultPrefix !== msg.guild.settings.prefix) {
return msg.channel.send(`Whoops! Looks like you are thinking of my default prefix. That is not the case here. Please use: ${msg.guild.settings.prefix}`);
if (defaultPrefix !== guildPrefix) {
return msg.sendLocale("PREFIXHELP_DEFAULT", [guildPrefix]);
}
}
if (msg.content === `${defaultPrefix.replace("~", "-")}help`) {
if (defaultPrefix.replace("~", "-") !== guildPrefix) {
return msg.sendLocale("PREFIXHELP_MISREAD");
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "margarine",
"version": "1.3.3",
"version": "1.3.4",
"description": "Javascript bot using the Klasa framework",
"main": "index.js",
"dependencies": {
Expand Down

0 comments on commit 94db282

Please sign in to comment.