Switch to ESLint formatting

This commit is contained in:
Tulir Asokan
2017-11-25 15:12:05 +02:00
parent 77a2705dd9
commit 64462af078
3 changed files with 15 additions and 17 deletions
+13 -14
View File
@@ -344,26 +344,25 @@ class MautrixTelegram {
const args = evt.content.body.substr(prefixLength) const args = evt.content.body.substr(prefixLength)
.split(" ") .split(" ")
const command = args.shift() const command = args.shift()
commands.run(user, command, args, const replyFunc = (reply, { allowHTML = false, markdown = true } = {}) => {
(reply, { allowHTML = false, markdown = true } = {}) => { reply = reply.replace("$cmdprefix", cmdprefix)
reply = reply.replace("$cmdprefix", cmdprefix) if (!markdown && !allowHTML) {
if (!markdown && !allowHTML) { reply = escapeHTML(reply)
reply = escapeHTML(reply) }
} if (markdown) {
if (markdown) { reply = marked(reply, {
reply = marked(reply, { sanitize: allowHTML,
sanitize: allowHTML, })
}) }
} this.botIntent.sendMessage(
this.botIntent.sendMessage(
evt.room_id, { evt.room_id, {
body: sanitizeHTML(reply), body: sanitizeHTML(reply),
formatted_body: reply, formatted_body: reply,
msgtype: "m.notice", msgtype: "m.notice",
format: "org.matrix.custom.html", format: "org.matrix.custom.html",
}) })
}, }
this) commands.run(user, command, args, replyFunc, this)
return return
} }
+1 -1
View File
@@ -174,7 +174,7 @@ commands.search = async (sender, args, reply, app) => {
reply("Usage: $cmdprefix search [-r|--remote] <query>") reply("Usage: $cmdprefix search [-r|--remote] <query>")
return return
} }
let msg = [] const msg = []
if (args[0] !== "-r" && args[0] !== "--remote") { if (args[0] !== "-r" && args[0] !== "--remote") {
const contactResults = await sender.searchContacts(args.join(" ")) const contactResults = await sender.searchContacts(args.join(" "))
if (contactResults.length > 0) { if (contactResults.length > 0) {
+1 -2
View File
@@ -90,8 +90,7 @@ class TelegramPeer {
} }
async getInfo(telegramPOV) { async getInfo(telegramPOV) {
let info, let info, users
users
switch (this.type) { switch (this.type) {
case "user": case "user":
info = await telegramPOV.client("users.getFullUser", { info = await telegramPOV.client("users.getFullUser", {