misc.vote: fix topic with spaces
This commit is contained in:
parent
063dd0c3f1
commit
c699c04717
1 changed files with 15 additions and 4 deletions
|
@ -254,11 +254,14 @@ const vote = new Command("vote");
|
||||||
vote.category = CATEGORY;
|
vote.category = CATEGORY;
|
||||||
vote.helpText = "Start a yes/no vote";
|
vote.helpText = "Start a yes/no vote";
|
||||||
vote.usage = "[topic]";
|
vote.usage = "[topic]";
|
||||||
vote.callback = async function (msg, line, [topic], {maybe}) {
|
vote.callback = async function (msg, line, topic, {maybe}) {
|
||||||
if (!topic) return "No topic given.";
|
if (!topic) return "No topic given.";
|
||||||
|
topic = topic.join(" ");
|
||||||
|
|
||||||
return {
|
return {
|
||||||
content: `**${msg.author.username}#${msg.author.discriminator}** has started a vote:\n**__${topic}__**\n<:ms_tick:503341995348066313>: Yes\n<:ms_cross:503341994974773250>: No${
|
content: `**${msg.author.username}#${
|
||||||
|
msg.author.discriminator
|
||||||
|
}** has started a vote:\n**__${topic}__**\n<:ms_tick:503341995348066313>: Yes\n<:ms_cross:503341994974773250>: No${
|
||||||
maybe ? "\n<:ms_tilda:581268710925271095>: Maybe/Uncertain" : ""
|
maybe ? "\n<:ms_tilda:581268710925271095>: Maybe/Uncertain" : ""
|
||||||
}`,
|
}`,
|
||||||
addReactions: [
|
addReactions: [
|
||||||
|
@ -572,10 +575,18 @@ search.callback = async function (msg, line, args, {results = 2}) {
|
||||||
let out = `__**Results for \`${safeString(query)}\`**__\n`;
|
let out = `__**Results for \`${safeString(query)}\`**__\n`;
|
||||||
for (const result of searchResults) {
|
for (const result of searchResults) {
|
||||||
if (result.special_response) {
|
if (result.special_response) {
|
||||||
out += "> " + safeString(parseHtmlEntities(result.special_response.response.split("\n").join("\n> ")));
|
out +=
|
||||||
|
"> " +
|
||||||
|
safeString(
|
||||||
|
parseHtmlEntities(
|
||||||
|
result.special_response.response.split("\n").join("\n> ")
|
||||||
|
)
|
||||||
|
);
|
||||||
out += `\n<${encodeURI(result.special_response.source)}>`;
|
out += `\n<${encodeURI(result.special_response.source)}>`;
|
||||||
} else {
|
} else {
|
||||||
out += `**${safeString(parseHtmlEntities(result.title))}** - <${encodeURI(result.url)}>`;
|
out += `**${safeString(parseHtmlEntities(result.title))}** - <${encodeURI(
|
||||||
|
result.url
|
||||||
|
)}>`;
|
||||||
out += `\n> ${safeString(parseHtmlEntities(result.description))}`;
|
out += `\n> ${safeString(parseHtmlEntities(result.description))}`;
|
||||||
}
|
}
|
||||||
out += "\n\n";
|
out += "\n\n";
|
||||||
|
|
Loading…
Reference in a new issue