Skip to content

Commit 1661e35

Browse files
committed
Fix formatting
1 parent 654c8d7 commit 1661e35

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

telegram-bot/esbuild.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { context } from "esbuild";
1+
import { context } from 'esbuild';
22
import { wasmLoader } from 'esbuild-plugin-wasm';
33

44
const watch = process.argv.includes('--watch');

telegram-bot/index.ts

+13-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import * as fend from 'fend-wasm';
1+
import { evaluateFendWithTimeout, substituteInlineFendExpressions } from 'fend-wasm';
22

3-
const two = fend.evaluateFendWithTimeout('1+1', 500);
3+
const two = evaluateFendWithTimeout('1+1', 500);
44
if (two !== '2') {
55
throw new Error(`could not execute webassembly: got '${two}' instead of '2'`);
66
}
@@ -35,13 +35,13 @@ type Update = {
3535

3636
function processInput(input: string, chatType: string) {
3737
if (input == '/start' || input == '/help') {
38-
return "fend is an arbitrary-precision unit-aware calculator.\n\nYou can send it maths questions like '1+1', 'sin(pi)' or 'sqrt(5)'. In group chats, you'll need to enclose your input in [[double square brackets]] like this: [[1+1]].";
38+
return "fend is an arbitrary-precision unit-aware calculator.\n\nYou can send maths questions like '1+1', 'sin(pi)' or 'sqrt(5)'. In group chats, you'll need to enclose your input in [[double square brackets]] like this: [[1+1]].";
3939
}
4040

4141
if (chatType == 'private' || chatType == 'inline') {
42-
return fend.evaluateFendWithTimeout(input, 500);
42+
return evaluateFendWithTimeout(input, 500);
4343
} else if (chatType == 'group' || chatType == 'supergroup' || chatType == 'channel') {
44-
let response = JSON.parse(fend.substituteInlineFendExpressions(input, 500));
44+
let response = JSON.parse(substituteInlineFendExpressions(input, 500));
4545
let result = '';
4646
let foundCalculation = false;
4747
for (let part of response) {
@@ -96,7 +96,14 @@ async function processUpdate(update: Update) {
9696
let result = processInput(input, 'inline');
9797
let results: InlineQueryResult[] = [];
9898
if (result != null && result != '') {
99-
results.push({type: 'article', title: result, id: '1', input_message_content: {message_text: result}});
99+
results.push({
100+
type: 'article',
101+
title: result,
102+
id: '1',
103+
input_message_content: {
104+
message_text: result,
105+
},
106+
});
100107
}
101108
await postJSON('answerInlineQuery', {
102109
inline_query_id: update.inline_query.id,

0 commit comments

Comments
 (0)