27 lines
773 B
JavaScript
27 lines
773 B
JavaScript
const {addCommand} = require("../lib/command");
|
|
const {startPrompt} = require("../lib/prompt");
|
|
|
|
addCommand("e", "emote", function () {
|
|
if (!comcord.state.currentChannel) {
|
|
console.log("<not in a channel>");
|
|
return;
|
|
}
|
|
|
|
startPrompt(":emote> ", async function (input) {
|
|
if (input == "") {
|
|
console.log("<no message sent>");
|
|
} else {
|
|
try {
|
|
process.stdout.write("\n");
|
|
await comcord.client.guilds
|
|
.get(comcord.state.currentGuild)
|
|
.channels.get(comcord.state.currentChannel)
|
|
.createMessage({content: `*${input}*`});
|
|
console.log(`<${comcord.client.user.username} ${input}>`);
|
|
} catch (err) {
|
|
console.log("<failed to send message: " + err.message + ">");
|
|
}
|
|
}
|
|
});
|
|
});
|