a bit markdown

This commit is contained in:
Flummi 2017-11-20 23:16:49 +01:00
parent 22d911aaaa
commit ea25b51ae0
9 changed files with 27 additions and 15 deletions

View File

@ -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;

View File

@ -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, "<b>$1</b>") // bold
.replace(/\[i\](.*?)\[\/i\]/g, "<i>$1</i>") // italic
;
}
}
module.exports = tg;

View File

@ -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.`);
}
});
};

View File

@ -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.`);
}
});
};

View File

@ -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]`);
});
});
});

View File

@ -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 \\________`);
}
});
};

View File

@ -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!`);
}
});
};

View File

@ -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(", "));
});
});

View File

@ -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`);
}
});
};