mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-10-23 08:33:09 +00:00
bots: SimpleX Calculator demo bot (#7583)
* bots: SimpleX Calculator demo bot * refactor * use local server in test * simplify * icon * simplify * expression * replies * improve * log * update name in bot address * @simplex-chat/type: 0.12.0 * simplex-chat nodejs: 7.1.0-beta.4.2 * update dependencies * option to add domain to bot address --------- Co-authored-by: Evgeny @ SimpleX Chat <259188159+evgeny-simplex@users.noreply.github.com>
This commit is contained in:
1 parent
4cb244441b
commit
643a9afad6
35 files changed
+1075
-49
No files matched your search
@@ -1,12 +1,12 @@
|
||||
(async () => {
|
||||
const {bot} = await import("../dist/index.js")
|
||||
const [chat, _user, _address] = await bot.run({
|
||||
await bot.run({
|
||||
profile: {displayName: "Squaring bot example", fullName: ""},
|
||||
dbOpts: {type: "sqlite", filePrefix: "./squaring_bot"},
|
||||
options: {
|
||||
addressSettings: {welcomeMessage: "Send a number, I will square it."},
|
||||
},
|
||||
onMessage: async (ci, content) => {
|
||||
onMessage: async (ci, content, chat) => {
|
||||
const n = +content.text
|
||||
const reply = typeof n === "number" && !isNaN(n)
|
||||
? `${n} * ${n} = ${n * n}`
|
||||
|
||||
Reference in new issue
Block a user