Leask / halbot

Just another `ChatGPT` / `Gemini` / `Mistral (by ollama)` Telegram bob, which is simple design, easy to use, extendable and fun.
https://leaskh.com/post/711636926789271552/halbot
MIT License
101 stars 16 forks source link

[HALBOT] AssertionError [ERR_ASSERTION]: Telegram Bot API Token is required. #6

Closed elliclee closed 1 year ago

elliclee commented 1 year ago

My Step 1: $vi ~/.halbot.json , and them type the config and :wq

{

    // REQUIRED, string.
    "telegramToken": "1111:token",

    // OPTIONAL, string.
    // One of the chatGptKey or bingToken is required.
    "chatGptKey": "apikey...",

    // OPTIONAL, string.
    // One of the chatGptKey or bingToken is required.
    "bingToken": "[[Bing Usertoken from cookies]]",

    // OPTIONAL, string.
    // Set this field if you need TTS/STT features.
    "googleApiKey": "[[Google Cloud API Key]]",

    // OPTIONAL, undefined || array of string.
    // To open the bot to PUBLIC, DO NOT set this field;
    // To restrict the bot to PRIVATE, set chat/group/channel ids in this array.
    "private": ["[[CHAT_ID]]", "[[GROUP_ID]]", "[[CHANNEL_ID]]", ...],

    // OPTIONAL, string.
    // Set this field if you want to use a `magic word` to authenticate the bot.
    "magicWord": "[[Your Magic Word here]]",

    // OPTIONAL, string.
    // Use a HOME GROUP to authentication users.
    // Anyone in this group can access the bot.
    "homeGroup": "[[GROUP_ID]]",

    // OPTIONAL, array of enum string.
    // Enum: 'private', 'mention', 'group', 'channel'.
    // Defaule: ['private', 'mention'].
    // By default, it will only reply to `private` chats and group `mention`s.
    // Adding 'group' or 'channel' may cause too much disturbance.
    "chatType": ["mention", "private"]

}

Step 2: $npx halbot

but finally I got this :

root@ubuntu-s-1gb-sgp1-tg:~# npx halbot
Need to install the following packages:
  halbot@1989.6.26
Ok to proceed? (y) y
[HALBOT] AssertionError [ERR_ASSERTION]: Telegram Bot API Token is required.

How could I fix it. Thx in advance~

elliclee commented 1 year ago

Still got the same Problem:

root@ubuntu-s-1gb-sgp1-tg:~# sudo chmod 777 ~/.halbot.json
root@ubuntu-s-1gb-sgp1-tg:~# DEBUG=1 npx halbot
file:///root/.npm/_npx/c35c4739108a4593/node_modules/utilitas/lib/utilitas.mjs:17
const newError = (msg, status, opt) => extError(new Error(msg), status, opt);
                                                ^

Error: AssertionError [ERR_ASSERTION]: Telegram Bot API Token is required.
    at newError (file:///root/.npm/_npx/c35c4739108a4593/node_modules/utilitas/lib/utilitas.mjs:17:49)
    at Module.throwError (file:///root/.npm/_npx/c35c4739108a4593/node_modules/utilitas/lib/utilitas.mjs:18:50)
    at file:///root/.npm/_npx/c35c4739108a4593/node_modules/halbot/bin/halbot.mjs:32:34 {
  status: undefined
}

Node.js v18.7.0
elliclee commented 1 year ago

@Leask Could You help me fix this problem~

Leask commented 1 year ago

It’s a JSON file. Please delete all the comment lines in it. 🤣

elliclee commented 1 year ago

@Leask Leask, thx