3.9.0, chainable string modifiers

This commit is contained in:
hydrabolt
2015-10-25 19:27:43 +00:00
parent f9679879f2
commit b61c64fa48
6 changed files with 82 additions and 50 deletions

View File

@@ -9,4 +9,27 @@ var Discord = {
Client: Client
};
Discord.patchStrings = function () {
defineProperty("bold", "**");
defineProperty("underline", "__");
defineProperty("strike", "~~");
defineProperty("code", "`");
defineProperty("codeblock", "```");
Object.defineProperty(String.prototype, "italic", {
get: function () {
return "*" + this + "*";
}
});
function defineProperty(name, joiner) {
Object.defineProperty(String.prototype, name, {
get: function () {
return joiner + this + joiner;
}
});
}
}
module.exports = Discord;