-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
simplified web worker launch process + adapted to next client version
- Loading branch information
1 parent
4a9a291
commit a938a00
Showing
22 changed files
with
327 additions
and
338 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
docs/telegram-bot-playground/assets/web-worker-BcVFCjdL.js
Large diffs are not rendered by default.
Oops, something went wrong.
22 changes: 0 additions & 22 deletions
22
docs/telegram-bot-playground/assets/web-worker-DkORvJaQ.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
import type { BotMessageHandlers } from "@effect-ak/tg-bot-client" | ||
import { BotResponse, defineBot } from "@effect-ak/tg-bot-client" | ||
|
||
export default { | ||
export default defineBot({ | ||
on_message: (msg) => { | ||
|
||
if (msg.text) { | ||
return { | ||
return BotResponse.make({ | ||
type: "message", | ||
text: "hey 😀" | ||
} | ||
}) | ||
} | ||
|
||
return BotResponse.ignore; | ||
|
||
}, | ||
} satisfies BotMessageHandlers | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,31 @@ | ||
import type { BotMessageHandlers } from "@effect-ak/tg-bot-client" | ||
import { BotResponse, defineBot } from "@effect-ak/tg-bot-client" | ||
|
||
export default { | ||
export default defineBot({ | ||
on_message: (msg) => { | ||
if (msg.text?.includes("+")) { | ||
const numbers = msg.text.split("+"); | ||
let result = 0; | ||
for (const num of numbers) { | ||
result += parseInt(num); | ||
} | ||
return { | ||
return BotResponse.make({ | ||
type: "document", | ||
caption: "sum result", | ||
document: { | ||
file_content: new TextEncoder().encode(`your sum is ${result}`), | ||
file_name: "hello.txt" | ||
} | ||
} | ||
}) | ||
} | ||
|
||
if (msg.text) { //reply on any text message | ||
return { | ||
return BotResponse.make({ | ||
type: "message", | ||
text: "hey 🙃, send me a message in the format '3+3+3' and I will return you the sum of it in a text file" | ||
} | ||
}) | ||
} | ||
|
||
return BotResponse.ignore; | ||
|
||
}, | ||
} satisfies BotMessageHandlers | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
import type { Monaco } from "@monaco-editor/loader"; | ||
import { fetchText } from "#/common/utils"; | ||
import { CDN_PACKAGE_DTS } from "#/tg-bot-playground/const"; | ||
|
||
export const setupDts = async ( | ||
monaco: Monaco | ||
) => { | ||
|
||
const dts = await fetchText("https://cdn.jsdelivr.net/npm/@effect-ak/[email protected]/dist/index.d.ts"); | ||
const dts = await fetchText(`https://cdn.jsdelivr.net/npm/${CDN_PACKAGE_DTS}`); | ||
|
||
monaco.languages.typescript.typescriptDefaults.setExtraLibs([ | ||
{ | ||
|
@@ -23,4 +24,4 @@ export const setupDts = async ( | |
strict: true | ||
}); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const CLIENT_VERSION = "0.5.1"; | ||
export const CDN_PACKAGE_MAIN = `@effect-ak/tg-bot-client@${CLIENT_VERSION}/dist/index.min.mjs`; | ||
export const CDN_PACKAGE_DTS = `@effect-ak/tg-bot-client@${CLIENT_VERSION}/dist/index.d.ts`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
import type { BotMessageHandlers } from "@effect-ak/tg-bot-client" | ||
import { BotResponse, defineBot } from "@effect-ak/tg-bot-client" | ||
|
||
export default { | ||
export default defineBot({ | ||
on_message: (msg) => { | ||
|
||
if (msg.text) { | ||
return { | ||
return BotResponse.make({ | ||
type: "message", | ||
text: "hey 😀" | ||
} | ||
}) | ||
} | ||
|
||
return BotResponse.ignore; | ||
|
||
}, | ||
} satisfies BotMessageHandlers | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,31 @@ | ||
import type { BotMessageHandlers } from "@effect-ak/tg-bot-client" | ||
import { BotResponse, defineBot } from "@effect-ak/tg-bot-client" | ||
|
||
export default { | ||
export default defineBot({ | ||
on_message: (msg) => { | ||
if (msg.text?.includes("+")) { | ||
const numbers = msg.text.split("+"); | ||
let result = 0; | ||
for (const num of numbers) { | ||
result += parseInt(num); | ||
} | ||
return { | ||
return BotResponse.make({ | ||
type: "document", | ||
caption: "sum result", | ||
document: { | ||
file_content: new TextEncoder().encode(`your sum is ${result}`), | ||
file_name: "hello.txt" | ||
} | ||
} | ||
}) | ||
} | ||
|
||
if (msg.text) { //reply on any text message | ||
return { | ||
return BotResponse.make({ | ||
type: "message", | ||
text: "hey 🙃, send me a message in the format '3+3+3' and I will return you the sum of it in a text file" | ||
} | ||
}) | ||
} | ||
|
||
return BotResponse.ignore; | ||
|
||
}, | ||
} satisfies BotMessageHandlers | ||
}) |
Oops, something went wrong.