diff --git a/src/inc/clients/irc.js b/src/inc/clients/irc.js index ee5f9cc..a764a6f 100644 --- a/src/inc/clients/irc.js +++ b/src/inc/clients/irc.js @@ -85,9 +85,9 @@ class irc { message: tmp.params[1], time: ~~(Date.now() / 1000), raw: tmp, - reply: msg => this.send(`PRIVMSG ${tmp.params[0]} :${msg}`), - replyAction: msg => this.send(`PRIVMSG ${tmp.params[0]} :\u0001ACTION ${msg}\u0001`), - replyNotice: msg => this.send(`NOTICE ${tmp.params[0]} :${msg}`), + reply: msg => this.send(`PRIVMSG ${tmp.params[0]} :${this.format(msg)}`), + replyAction: msg => this.send(`PRIVMSG ${tmp.params[0]} :\u0001ACTION ${this.format(msg)}\u0001`), + replyNotice: msg => this.send(`NOTICE ${tmp.params[0]} :${this.format(msg)}`), _chan: this.server.channel[tmp.params[0]], _user: this.server.user, _cmd: this._cmd, @@ -118,6 +118,12 @@ class irc { hostname: prefix[3] }; } + format(msg) { + return msg + .replace(/\[b\](.*?)\[\/b\]/g, "\x02$1\x0F") // bold + .replace(/\[i\](.*?)\[\/i\]/g, "\x1D$1\x0F") // italic + ; + } } module.exports = irc; diff --git a/src/inc/clients/tg.js b/src/inc/clients/tg.js index 8436f2a..862855d 100644 --- a/src/inc/clients/tg.js +++ b/src/inc/clients/tg.js @@ -29,7 +29,7 @@ class tg { }); } send(id, msg) { - this.client.sendMessage(id, msg); + this.client.sendMessage(id, msg, { parse_mode: "HTML" }); } reply(tmp) { return { @@ -45,12 +45,18 @@ class tg { message: tmp.text, time: tmp.date, raw: tmp, - reply: msg => this.send(tmp.chat.id, msg), - replyAction: msg => this.send(tmp.chat.id, `Uwe ${msg}`), - replyNotice: msg => this.send(tmp.chat.id, msg), + reply: msg => this.send(tmp.chat.id, this.format(msg)), + replyAction: msg => this.send(tmp.chat.id, this.format(`Uwe ${msg}`)), + replyNotice: msg => this.send(tmp.chat.id, this.format(msg)), _user: this.server.user }; } + format(msg) { + return msg + .replace(/\[b\](.*?)\[\/b\]/g, "$1") // bold + .replace(/\[i\](.*?)\[\/i\]/g, "$1") // italic + ; + } } module.exports = tg; diff --git a/src/inc/trigger/abschieben.js b/src/inc/trigger/abschieben.js index 8b281ed..e1c2984 100644 --- a/src/inc/trigger/abschieben.js +++ b/src/inc/trigger/abschieben.js @@ -16,7 +16,7 @@ module.exports = bot => { let args = e.message.trim().split(" "); args.shift(); args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0]; - e.replyAction(`schiebt ${args[0]} ${Dest[~~(Math.random() * Dest.length)]} ab.`); + e.replyAction(`schiebt [b]${args[0]}[/b] ${Dest[~~(Math.random() * Dest.length)]} ab.`); } }); }; diff --git a/src/inc/trigger/butterkaese.js b/src/inc/trigger/butterkaese.js index 60d4cc4..5edab84 100644 --- a/src/inc/trigger/butterkaese.js +++ b/src/inc/trigger/butterkaese.js @@ -8,7 +8,7 @@ module.exports = bot => { let args = e.message.trim().split(" "); args.shift(); args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0]; - e.replyAction(`drischt mit einem großen Stück Butterkäse auf ${args[0]} ein.`); + e.replyAction(`drischt mit einem großen Stück Butterkäse auf [b]${args[0]}[/b] ein.`); } }); }; diff --git a/src/inc/trigger/coins.js b/src/inc/trigger/coins.js index 7007609..c905c47 100644 --- a/src/inc/trigger/coins.js +++ b/src/inc/trigger/coins.js @@ -51,7 +51,7 @@ const cryptowat_summary = (crypto, market, currency) => { volume: result.volume }; - resolve(`Current: ${data.last} - High: ${data.high} - Low: ${data.low} - Change: ${data.change}% - Volume: ${data.volume}`); + resolve(`Current: [b]${data.last}[/b] - High: [b]${data.high}[/b] - Low: [b]${data.low}[/b] - Change: [b]${data.change}[/b]% - Volume: [b]${data.volume}[/b]`); }); }); }); diff --git a/src/inc/trigger/drugs.js b/src/inc/trigger/drugs.js index 0f76d7d..c706eb0 100644 --- a/src/inc/trigger/drugs.js +++ b/src/inc/trigger/drugs.js @@ -59,7 +59,7 @@ module.exports = bot => { , action = actions[consume_type][~~(Math.random() * actions[consume_type].length)] , strain = strains[strain_type][~~(Math.random() * strains[strain_type].length)]; - e.replyAction(`${action[0]} a ${consume_type} of the finest ${strain_type} "${strain}" ${action[1]} ${args[0]}`); + e.replyAction(`${action[0]} a ${consume_type} of the finest ${strain_type} "${strain}" ${action[1]} [b]${args[0]}[/b]`); } }); @@ -73,7 +73,7 @@ module.exports = bot => { args.shift(); args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0]; - e.replyAction(`legt ${args[0]} eine dicke Line Meth \\________`); + e.replyAction(`legt [b]${args[0]}[/b] eine dicke Line Meth \\________`); } }); }; \ No newline at end of file diff --git a/src/inc/trigger/kaffee.js b/src/inc/trigger/kaffee.js index 0009354..5ff6a0a 100644 --- a/src/inc/trigger/kaffee.js +++ b/src/inc/trigger/kaffee.js @@ -13,7 +13,7 @@ module.exports = bot => { let args = e.message.trim().split(" "); args.shift(); args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0]; - e.replyAction(`serviert ${args.join(" ")} ${texte[~~(Math.random() * texte.length)]}; Prost!`); + e.replyAction(`serviert [b]${args.join(" ")}[/b] ${texte[~~(Math.random() * texte.length)]}; Prost!`); } }); }; diff --git a/src/inc/trigger/kernel.js b/src/inc/trigger/kernel.js index 1c922de..26fd62c 100644 --- a/src/inc/trigger/kernel.js +++ b/src/inc/trigger/kernel.js @@ -16,7 +16,7 @@ module.exports = bot => { const releases = JSON.parse(content).releases; const out = []; for (let entry in releases) - out.push(`${releases[entry].version} (${releases[entry].moniker}${releases[entry].iseol ? `, EOL` : ""})`); + out.push(`[b]${releases[entry].version}[/b] (${releases[entry].moniker}${releases[entry].iseol ? `, EOL` : ""})`); e.reply(out.join(", ")); }); }); diff --git a/src/inc/trigger/notschlachten.js b/src/inc/trigger/notschlachten.js index 14db2eb..b2532c3 100644 --- a/src/inc/trigger/notschlachten.js +++ b/src/inc/trigger/notschlachten.js @@ -8,7 +8,7 @@ module.exports = bot => { let args = e.message.trim().split(" "); args.shift(); args[0] = (args[0] == String.empty || typeof args[0] === "undefined" || args[0] == "") ? e.user.nick : args[0]; - e.replyAction(`notschlachtet ${args[0]} und entsorgt die Leiche im Biomüll`); + e.replyAction(`notschlachtet [b]${args[0]}[/b] und entsorgt die Leiche im Biomüll`); } }); }; \ No newline at end of file