-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add: make-in-sql-store.ts #1183
base: master
Are you sure you want to change the base?
Conversation
I left the author's credits because it's not mine. I just tried to implement it directly in baileys and try it on a few projects.
Thanks for your contribution. The next step is to wait for review and approval to merge it to main repository The community can help reacting with a thumb up (:thumbsup:) for approval and rocket (:rocket:) for who has tested it. To test this PR you can run the following command below:
|
Very good |
Could you please give me an example of how to use it so I can test it? |
const { saveCreds, state } = await useMultiFileAuthState('./auth');
const { version, isLatest } = await fetchLatestBaileysVersion();
const store = await makeInSQLiteStore("1", "./store.db", pino({ level: 'silent' }))
const zk = makeWASocket({
version: version,
logger: logger,
browser: ['Zokou-md', 'safari', '1.0.0'],
emitOwnEvents: true,
syncFullHistory: true,
printQRInTerminal: true,
markOnlineOnConnect: false,
receivedPendingNotifications: true,
generateHighQualityLinkPreview: true,
auth: {
creds: state.creds,
keys: makeCacheableSignalKeyStore(state.keys, logger)
},
keepAliveIntervalMs: 30_000,
getMessage: async (msg) => {
if (store) {
const m = await store.loadMessage(msg.remoteJid, msg.id);
return m?.message || undefined
}
}```
same like makeInMemoryStore |
Thank you, I will test it. |
I don't think this should be added. It adds not required weight for people who want to either implement their own or use different one. Instead you could make this into addon/gist. |
Always bind your events to save to SQLite await store.bind(zk.ev); |
I left the author's credits because it's not mine. I just tried to implement it directly in baileys and try it on a few projects.