Closed chelaxian closed 6 months ago
after i start bot with command - "npm run dev" it says:
> node-midjourney-telegram-bot@1.0.0 dev > nodemon app.js [nodemon] 3.0.1 [nodemon] to restart at any time, enter `rs` [nodemon] watching path(s): *.* [nodemon] watching extensions: js,mjs,cjs,json [nodemon] starting `node app.js`
in telegram I see - "Hi, I'm Image Generator bot. Try me /mj whats on my mind." then i send to it /mj command with promt and bot says "prompt: "whats on my mind" received generating image..."
in console i see:
Unhandled rejection Error: ETELEGRAM: 400 Bad Request: message text is empty at /root/github/MJ/node-midJourney-telegram-bot/node_modules/node-telegram-bot-api/src/telegram.js:299:15 at tryCatcher (/root/github/MJ/node-midJourney-telegram-bot/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/root/github/MJ/node-midJourney-telegram-bot/node_modules/bluebird/js/release/promise.js:547:31) at Promise._settlePromise (/root/github/MJ/node-midJourney-telegram-bot/node_modules/bluebird/js/release/promise.js:604:18) at Promise._settlePromise0 (/root/github/MJ/node-midJourney-telegram-bot/node_modules/bluebird/js/release/promise.js:649:10) at Promise._settlePromises (/root/github/MJ/node-midJourney-telegram-bot/node_modules/bluebird/js/release/promise.js:729:18) at _drainQueueStep (/root/github/MJ/node-midJourney-telegram-bot/node_modules/bluebird/js/release/async.js:93:12) at _drainQueue (/root/github/MJ/node-midJourney-telegram-bot/node_modules/bluebird/js/release/async.js:86:9) at Async._drainQueues (/root/github/MJ/node-midJourney-telegram-bot/node_modules/bluebird/js/release/async.js:102:5) at Async.drainQueues [as _onImmediate] (/root/github/MJ/node-midJourney-telegram-bot/node_modules/bluebird/js/release/async.js:15:14) at process.processImmediate (node:internal/timers:476:21)
and then after some time i see also this:
/root/github/MJ/node-midJourney-telegram-bot/node_modules/mongoose/lib/connection.js:805 err = new ServerSelectionError(); ^ MongooseServerSelectionError: connect ECONNREFUSED ::1:27017 at _handleConnectionErrors (/root/github/MJ/node-midJourney-telegram-bot/node_modules/mongoose/lib/connection.js:805:11) at NativeConnection.openUri (/root/github/MJ/node-midJourney-telegram-bot/node_modules/mongoose/lib/connection.js:780:11) { reason: TopologyDescription { type: 'Unknown', servers: Map(1) { 'localhost:27017' => ServerDescription { address: 'localhost:27017', type: 'Unknown', hosts: [], passives: [], arbiters: [], tags: {}, minWireVersion: 0, maxWireVersion: 0, roundTripTime: -1, lastUpdateTime: 2660883, lastWriteDate: 0, error: MongoNetworkError: connect ECONNREFUSED ::1:27017 at connectionFailureError (/root/github/MJ/node-midJourney-telegram-bot/node_modules/mongodb/lib/cmap/connect.js:367:20) at Socket.<anonymous> (/root/github/MJ/node-midJourney-telegram-bot/node_modules/mongodb/lib/cmap/connect.js:290:22) at Object.onceWrapper (node:events:632:26) at Socket.emit (node:events:517:28) at emitErrorNT (node:internal/streams/destroy:151:8) at emitErrorCloseNT (node:internal/streams/destroy:116:3) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { cause: Error: connect ECONNREFUSED ::1:27017 at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16) { errno: -111, code: 'ECONNREFUSED', syscall: 'connect', address: '::1', port: 27017 }, [Symbol(errorLabels)]: Set(1) { 'ResetPool' } }, topologyVersion: null, setName: null, setVersion: null, electionId: null, logicalSessionTimeoutMinutes: null, primary: null, me: null, '$clusterTime': null } }, stale: false, compatible: true, heartbeatFrequencyMS: 10000, localThresholdMS: 15, setName: null, maxElectionId: null, maxSetVersion: null, commonWireVersion: 0, logicalSessionTimeoutMinutes: null }, code: undefined } Node.js v18.19.0 [nodemon] app crashed - waiting for file changes before starting...
how to fix it?
You can safely ignore this error message. You're getting this message only when bot is only sending images only.
Unhandled rejection Error: ETELEGRAM: 400 Bad Request: message text is empty
And abt the other error that's the main issue. Looks like your database isn't setuped correctly. Bot is unable to connect the the mongodb url. Kindly check your database connection string.
Thank you for answering and for sharing this project. I think it would be nice if you can add some little notes to README how to setup mongodb for this bot (commands to install and create database to get MongoDB URI string) to let me (and other users) double check DB setup. Thanks!
i snapback to clean snapshot and reinstall mongodb, npm and your project. used this guide for mongo - https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/
then typed "mongosh" and "use mjtgbot" then filled in ".env" (data is obfsucated):
TG_BOT_TOKEN=0000000000:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
SERVER_ID=0000000000000000000
CHANNEL_ID=0000000000000000000
SALAI_TOKEN=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
MONGO_DB="mongodb://127.0.0.1:27017/mjtgbot"
MONGODB_URI="mongodb://127.0.0.1:27017/mjtgbot"
still have this error:
Unhandled rejection Error: ETELEGRAM: 400 Bad Request: message text is empty
at /root/github/MJ/node-midJourney-telegram-bot/node_modules/node-telegram-bot-api/src/telegram.js:299:15
at tryCatcher (/root/github/MJ/node-midJourney-telegram-bot/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/root/github/MJ/node-midJourney-telegram-bot/node_modules/bluebird/js/release/promise.js:547:31)
at Promise._settlePromise (/root/github/MJ/node-midJourney-telegram-bot/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromise0 (/root/github/MJ/node-midJourney-telegram-bot/node_modules/bluebird/js/release/promise.js:649:10)
at Promise._settlePromises (/root/github/MJ/node-midJourney-telegram-bot/node_modules/bluebird/js/release/promise.js:729:18)
at _drainQueueStep (/root/github/MJ/node-midJourney-telegram-bot/node_modules/bluebird/js/release/async.js:93:12)
at _drainQueue (/root/github/MJ/node-midJourney-telegram-bot/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/root/github/MJ/node-midJourney-telegram-bot/node_modules/bluebird/js/release/async.js:102:5)
at Async.drainQueues [as _onImmediate] (/root/github/MJ/node-midJourney-telegram-bot/node_modules/bluebird/js/release/async.js:15:14)
at process.processImmediate (node:internal/timers:476:21)
still need help to get bot fully workable
P.S. thanks!
Sorry. I was away. Fixed readme and you can ignore this message.
ETELEGRAM: 400 Bad Request:
Bot is responsing right? Except for the empty message text issues?
Sorry. I was away. Fixed readme and you can ignore this message.
ETELEGRAM: 400 Bad Request:
Bot is responsing right? Except for the empty message text issues?
yes, telegram-bot responding but no image is generated. how to get SALAI_TOKEN ? i create new discord-bot and add it to may channel and use bot's SALAI_TOKEN. should i use bot's token or my own acc's token like here - https://www.androidauthority.com/get-discord-token-3149920/ ?
Sorry. I was away. Fixed readme and you can ignore this message.
ETELEGRAM: 400 Bad Request:
Bot is responsing right? Except for the empty message text issues?
yes, telegram-bot responding but no image is generated. how to get SALAI_TOKEN ? i create new discord-bot and add it to may channel and use bot's SALAI_TOKEN. should i use bot's token or my own acc's token like here - https://www.androidauthority.com/get-discord-token-3149920/ ?
Yes follow this guide.
thanks! now image is created in discord, but telegram-bot not sending to me resulting images. also would be nice if you add autoupdating of bot message with percentage of progress like in discord. to make users indeed that bot is busy right now and to not start new prompt.
p.s. still have this error (that you say i can ignore):
root@tg-gpt-bot:~/github/MJ/node-midJourney-telegram-bot# npm run dev
> node-midjourney-telegram-bot@1.0.0 dev
> nodemon app.js
[nodemon] 3.0.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,cjs,json
[nodemon] starting `node app.js`
š ws ready!!! Hi: XXX
/root/github/MJ/node-midJourney-telegram-bot/node_modules/mongoose/lib/connection.js:805
err = new ServerSelectionError();
^
MongooseServerSelectionError: connect ECONNREFUSED ::1:27017
at _handleConnectionErrors (/root/github/MJ/node-midJourney-telegram-bot/node_modules/mongoose/lib/connection.js:805:11)
at NativeConnection.openUri (/root/github/MJ/node-midJourney-telegram-bot/node_modules/mongoose/lib/connection.js:780:11) {
reason: TopologyDescription {
type: 'Unknown',
servers: Map(1) {
'localhost:27017' => ServerDescription {
address: 'localhost:27017',
type: 'Unknown',
hosts: [],
passives: [],
arbiters: [],
tags: {},
minWireVersion: 0,
maxWireVersion: 0,
roundTripTime: -1,
lastUpdateTime: 73750782,
lastWriteDate: 0,
error: MongoNetworkError: connect ECONNREFUSED ::1:27017
at connectionFailureError (/root/github/MJ/node-midJourney-telegram-bot/node_modules/mongodb/lib/cmap/connect.js:367:20)
at Socket.<anonymous> (/root/github/MJ/node-midJourney-telegram-bot/node_modules/mongodb/lib/cmap/connect.js:290:22)
at Object.onceWrapper (node:events:632:26)
at Socket.emit (node:events:517:28)
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
cause: Error: connect ECONNREFUSED ::1:27017
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16) {
errno: -111,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '::1',
port: 27017
},
[Symbol(errorLabels)]: Set(1) { 'ResetPool' }
},
topologyVersion: null,
setName: null,
setVersion: null,
electionId: null,
logicalSessionTimeoutMinutes: null,
primary: null,
me: null,
'$clusterTime': null
}
},
stale: false,
compatible: true,
heartbeatFrequencyMS: 10000,
localThresholdMS: 15,
setName: null,
maxElectionId: null,
maxSetVersion: null,
commonWireVersion: 0,
logicalSessionTimeoutMinutes: null
},
code: undefined
}
Node.js v18.19.0
[nodemon] app crashed - waiting for file changes before starting...
thanks! now image is created in discord, but telegram-bot not sending to me resulting images. also would be nice if you add autoupdating of bot message with percentage of progress like in discord. to make users indeed that bot is busy right now and to not start new prompt.
p.s. still have this error (that you say i can ignore):
root@tg-gpt-bot:~/github/MJ/node-midJourney-telegram-bot# npm run dev > node-midjourney-telegram-bot@1.0.0 dev > nodemon app.js [nodemon] 3.0.1 [nodemon] to restart at any time, enter `rs` [nodemon] watching path(s): *.* [nodemon] watching extensions: js,mjs,cjs,json [nodemon] starting `node app.js` š ws ready!!! Hi: XXX /root/github/MJ/node-midJourney-telegram-bot/node_modules/mongoose/lib/connection.js:805 err = new ServerSelectionError(); ^ MongooseServerSelectionError: connect ECONNREFUSED ::1:27017 at _handleConnectionErrors (/root/github/MJ/node-midJourney-telegram-bot/node_modules/mongoose/lib/connection.js:805:11) at NativeConnection.openUri (/root/github/MJ/node-midJourney-telegram-bot/node_modules/mongoose/lib/connection.js:780:11) { reason: TopologyDescription { type: 'Unknown', servers: Map(1) { 'localhost:27017' => ServerDescription { address: 'localhost:27017', type: 'Unknown', hosts: [], passives: [], arbiters: [], tags: {}, minWireVersion: 0, maxWireVersion: 0, roundTripTime: -1, lastUpdateTime: 73750782, lastWriteDate: 0, error: MongoNetworkError: connect ECONNREFUSED ::1:27017 at connectionFailureError (/root/github/MJ/node-midJourney-telegram-bot/node_modules/mongodb/lib/cmap/connect.js:367:20) at Socket.<anonymous> (/root/github/MJ/node-midJourney-telegram-bot/node_modules/mongodb/lib/cmap/connect.js:290:22) at Object.onceWrapper (node:events:632:26) at Socket.emit (node:events:517:28) at emitErrorNT (node:internal/streams/destroy:151:8) at emitErrorCloseNT (node:internal/streams/destroy:116:3) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { cause: Error: connect ECONNREFUSED ::1:27017 at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1555:16) { errno: -111, code: 'ECONNREFUSED', syscall: 'connect', address: '::1', port: 27017 }, [Symbol(errorLabels)]: Set(1) { 'ResetPool' } }, topologyVersion: null, setName: null, setVersion: null, electionId: null, logicalSessionTimeoutMinutes: null, primary: null, me: null, '$clusterTime': null } }, stale: false, compatible: true, heartbeatFrequencyMS: 10000, localThresholdMS: 15, setName: null, maxElectionId: null, maxSetVersion: null, commonWireVersion: 0, logicalSessionTimeoutMinutes: null }, code: undefined } Node.js v18.19.0 [nodemon] app crashed - waiting for file changes before starting...
Yeah sure. I'll work on the new feature. Btw you still getting mongodb error. You need to fix that and you're good to go.
thanks! the problem was that in /etc/mongod.conf
i setted 127.0.0.1 IP to listen mongod on. changing it to 0.0.0.0 solve the problem! now this error is gone but... telegram-bot still not sending generated pics to chat...
now abot not crashing and all i see in cli is:
root@tg-gpt-bot:~/github/MJ/node-midJourney-telegram-bot# npm run dev
> node-midjourney-telegram-bot@1.0.0 dev
> nodemon app.js
[nodemon] 3.0.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,mjs,cjs,json
[nodemon] starting `node app.js`
š ws ready!!! Hi: XXX
all i see in telegram-chat is:
X X, [08.02.2024 XX:10]
/start
XX_bot, [08.02.2024 XX:10]
Hi, X. I'm Image Generator bot. Try me
/mj whats on my mind.
X X, [08.02.2024 XX:12]
/mj whats on my mind.
XX_bot, [08.02.2024 XX:12]
prompt: "whats on my mind." received generating image...
where can i change this settings ? ::1:27017
to 127.0.0.1 or 0.0.0.0 ? i don't have ipv6
nevermind! changing /etc/mongod.conf to
net:
bindIp: 0.0.0.0, ::1
solve the problem! now all works! thank you again!
after i start bot with command - "npm run dev" it says:
in telegram I see - "Hi, I'm Image Generator bot. Try me /mj whats on my mind." then i send to it /mj command with promt and bot says "prompt: "whats on my mind" received generating image..."
in console i see:
and then after some time i see also this:
how to fix it?