[FEATURE] Add AI-based /ask command (complementing #54) #56
|
@ -5,3 +5,4 @@ npm-debug.log
|
||||||
.env
|
.env
|
||||||
*.md
|
*.md
|
||||||
!README.md
|
!README.md
|
||||||
|
ollama/
|
|
@ -5,6 +5,11 @@ botSource = "https://github.com/ABOCN/TelegramBot"
|
||||||
# insert token here
|
# insert token here
|
||||||
botToken = ""
|
botToken = ""
|
||||||
|
|
||||||
|
# ai features
|
||||||
|
ollamaEnabled = false
|
||||||
|
# ollamaApi = "http://ollama:11434"
|
||||||
|
# handlerTimeout = "600_000" # set higher if you expect to download larger models
|
||||||
|
|
||||||
# misc (botAdmins isnt a array here!)
|
# misc (botAdmins isnt a array here!)
|
||||||
maxRetries = 9999
|
maxRetries = 9999
|
||||||
botAdmins = 00000000, 00000000, 00000000
|
botAdmins = 00000000, 00000000, 00000000
|
||||||
|
|
6
.gitignore
vendored
|
@ -145,3 +145,9 @@ ffmpeg
|
||||||
|
|
||||||
# Bun
|
# Bun
|
||||||
bun.lock*
|
bun.lock*
|
||||||
|
|
||||||
|
# Ollama
|
||||||
|
ollama/
|
||||||
|
|
||||||
|
# Docker
|
||||||
|
docker-compose.yml
|
46
README.md
|
@ -10,12 +10,6 @@ Kowalski is a a simple Telegram bot made in Node.js.
|
||||||
|
|
||||||
- You can find Kowalski at [@KowalskiNodeBot](https://t.me/KowalskiNodeBot) on Telegram.
|
- You can find Kowalski at [@KowalskiNodeBot](https://t.me/KowalskiNodeBot) on Telegram.
|
||||||
|
|
||||||
## Translations
|
|
||||||
|
|
||||||
<a href="https://weblate.librecloud.cc/engage/kowalski/">
|
|
||||||
<img src="https://weblate.librecloud.cc/widget/kowalski/multi-auto.svg" alt="Translation status" />
|
|
||||||
</a>
|
|
||||||
|
|
||||||
## Self-host requirements
|
## Self-host requirements
|
||||||
|
|
||||||
> [!IMPORTANT]
|
> [!IMPORTANT]
|
||||||
|
@ -26,6 +20,11 @@ Kowalski is a a simple Telegram bot made in Node.js.
|
||||||
- FFmpeg (only for the `/yt` command)
|
- FFmpeg (only for the `/yt` command)
|
||||||
- Docker and Docker Compose (only required for Docker setup)
|
- Docker and Docker Compose (only required for Docker setup)
|
||||||
|
|
||||||
|
### AI Requirements
|
||||||
|
|
||||||
|
- High-end CPU *or* GPU (~ 6GB vRAM)
|
||||||
|
- If using CPU, enough RAM to load the models (~6GB w/ defaults)
|
||||||
|
|
||||||
## Running locally (non-Docker setup)
|
## Running locally (non-Docker setup)
|
||||||
|
|
||||||
First, clone the repo with Git:
|
First, clone the repo with Git:
|
||||||
|
@ -55,9 +54,28 @@ You can also run Kowalski using Docker, which simplifies the setup process. Make
|
||||||
|
|
||||||
### Using Docker Compose
|
### Using Docker Compose
|
||||||
|
|
||||||
1. **Make sure to setup your `.env` file first!**
|
1. **Copy compose file**
|
||||||
|
|
||||||
2. **Run the container**
|
_Without AI (Ollama)_
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mv docker-compose.yml.example docker-compose.yml
|
||||||
|
```
|
||||||
|
|
||||||
|
_With AI (Ollama)_
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mv docker-compose.yml.ai.example docker-compose.yml
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Make sure to setup your `.env` file first!**
|
||||||
|
|
||||||
|
> [!TIP]
|
||||||
|
> If you intend to setup AI, the defaults for Docker are already included (just uncomment) and don't need to be changed.
|
||||||
|
>
|
||||||
|
> Further setup may be needed for GPUs. See the Ollama documentation for more.
|
||||||
|
|
||||||
|
3. **Run the container**
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker compose up -d
|
docker compose up -d
|
||||||
|
@ -81,6 +99,9 @@ If you prefer to use Docker directly, you can use these instructions instead.
|
||||||
docker run -d --name kowalski --restart unless-stopped -v $(pwd)/.env:/usr/src/app/.env:ro kowalski
|
docker run -d --name kowalski --restart unless-stopped -v $(pwd)/.env:/usr/src/app/.env:ro kowalski
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> You must setup Ollama on your own if you would like to use AI features.
|
||||||
|
|
||||||
## .env Functions
|
## .env Functions
|
||||||
|
|
||||||
> [!IMPORTANT]
|
> [!IMPORTANT]
|
||||||
|
@ -90,6 +111,9 @@ If you prefer to use Docker directly, you can use these instructions instead.
|
||||||
- **botPrivacy**: Put the link to your bot privacy policy.
|
- **botPrivacy**: Put the link to your bot privacy policy.
|
||||||
- **maxRetries**: Maximum number of retries for a failing command on Kowalski. Default is 5. If the limit is hit, the bot will crash past this number.
|
- **maxRetries**: Maximum number of retries for a failing command on Kowalski. Default is 5. If the limit is hit, the bot will crash past this number.
|
||||||
- **botToken**: Put your bot token that you created at [@BotFather](https://t.me/botfather).
|
- **botToken**: Put your bot token that you created at [@BotFather](https://t.me/botfather).
|
||||||
|
- **ollamaEnabled** (optional): Enables/disables AI features
|
||||||
|
- **ollamaApi** (optional): Ollama API endpoint for various AI features, will be disabled if not set
|
||||||
|
- **handlerTimeout** (default: `600_000`): How long handlers will wait before timing out. Set this high if using large AI models.
|
||||||
- **botAdmins**: Put the ID of the people responsible for managing the bot. They can use some administrative + exclusive commands on any group.
|
- **botAdmins**: Put the ID of the people responsible for managing the bot. They can use some administrative + exclusive commands on any group.
|
||||||
- **lastKey**: Last.fm API key, for use on `lastfm.js` functions, like see who is listening to what song and etc.
|
- **lastKey**: Last.fm API key, for use on `lastfm.js` functions, like see who is listening to what song and etc.
|
||||||
- **weatherKey**: Weather.com API key, used for the `/weather` command.
|
- **weatherKey**: Weather.com API key, used for the `/weather` command.
|
||||||
|
@ -106,6 +130,12 @@ If you prefer to use Docker directly, you can use these instructions instead.
|
||||||
chmod +x src/plugins/yt-dlp/yt-dlp
|
chmod +x src/plugins/yt-dlp/yt-dlp
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### AI
|
||||||
|
|
||||||
|
**Q:** How can I disable AI features?
|
||||||
|
|
||||||
|
**A:** AI features are disabled by default, unless you have set `ollamaEnabled` to `true` in your `.env` file. Set it back to `false` to disable.
|
||||||
|
|
||||||
## Contributors
|
## Contributors
|
||||||
|
|
||||||
<a href="https://github.com/abocn/TelegramBot/graphs/contributors">
|
<a href="https://github.com/abocn/TelegramBot/graphs/contributors">
|
||||||
|
|
15
docker-compose.yml.ai.example
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
services:
|
||||||
|
kowalski:
|
||||||
|
build: .
|
||||||
|
container_name: kowalski
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- ./.env:/usr/src/app/.env:ro
|
||||||
|
environment:
|
||||||
|
- NODE_ENV=production
|
||||||
|
ollama:
|
||||||
|
image: ollama/ollama
|
||||||
|
container_name: kowalski-ollama
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- ./ollama:/root/.ollama
|
13
src/bot.ts
|
@ -4,6 +4,7 @@ import fs from 'fs';
|
||||||
import { isOnSpamWatch } from './spamwatch/spamwatch';
|
import { isOnSpamWatch } from './spamwatch/spamwatch';
|
||||||
import '@dotenvx/dotenvx';
|
import '@dotenvx/dotenvx';
|
||||||
import './plugins/ytDlpWrapper';
|
import './plugins/ytDlpWrapper';
|
||||||
|
import { preChecks } from './commands/ai';
|
||||||
|
|
||||||
// Ensures bot token is set, and not default value
|
// Ensures bot token is set, and not default value
|
||||||
if (!process.env.botToken || process.env.botToken === 'InsertYourBotTokenHere') {
|
if (!process.env.botToken || process.env.botToken === 'InsertYourBotTokenHere') {
|
||||||
|
@ -11,7 +12,17 @@ if (!process.env.botToken || process.env.botToken === 'InsertYourBotTokenHere')
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
const bot = new Telegraf(process.env.botToken);
|
// Detect AI and run pre-checks
|
||||||
|
if (process.env.ollamaEnabled === "true") {
|
||||||
|
if (!(await preChecks())) {
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const bot = new Telegraf(
|
||||||
|
process.env.botToken,
|
||||||
|
{ handlerTimeout: Number(process.env.handlerTimeout) || 600_000 }
|
||||||
|
);
|
||||||
const maxRetries = process.env.maxRetries || 5;
|
const maxRetries = process.env.maxRetries || 5;
|
||||||
let restartCount = 0;
|
let restartCount = 0;
|
||||||
|
|
||||||
|
|
287
src/commands/ai.ts
Normal file
|
@ -0,0 +1,287 @@
|
||||||
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
// AI.TS
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
// by ihatenodejs/Aidan
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
//
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
// -----------------------------------------------------------------------
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
//
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
// This is free and unencumbered software released into the public domain.
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
//
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
// Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
// distribute this software, either in source code form or as a compiled
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
// binary, for any purpose, commercial or non-commercial, and by any
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
// means.
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
//
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
// In jurisdictions that recognize copyright laws, the author or authors
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
// of this software dedicate any and all copyright interest in the
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
// software to the public domain. We make this dedication for the benefit
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
// of the public at large and to the detriment of our heirs and
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
// successors. We intend this dedication to be an overt act of
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
// relinquishment in perpetuity of all present and future rights to this
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
// software under copyright law.
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
//
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
// IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
//
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
// For more information, please refer to <https://unlicense.org/>
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
import { isOnSpamWatch } from "../spamwatch/spamwatch"
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
import spamwatchMiddlewareModule from "../spamwatch/Middleware"
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
import { Telegraf, Context } from "telegraf"
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
import type { Message } from "telegraf/types"
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
import { replyToMessageId } from "../utils/reply-to-message-id"
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
import { getStrings } from "../plugins/checklang"
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
import { languageCode } from "../utils/language-code"
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
import axios from "axios"
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
import { rateLimiter } from "../utils/rate-limiter"
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
import { logger } from "../utils/log"
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
const spamwatchMiddleware = spamwatchMiddlewareModule(isOnSpamWatch)
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
export const flash_model = "gemma3:4b"
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
export const thinking_model = "deepseek-r1:1.5b"
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
type TextContext = Context & { message: Message.TextMessage }
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
export function sanitizeForJson(text: string): string {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
return text
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
.replace(/\\/g, '\\\\')
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
.replace(/"/g, '\\"')
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
.replace(/\n/g, '\\n')
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
.replace(/\r/g, '\\r')
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
.replace(/\t/g, '\\t')
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
}
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
export async function preChecks() {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
const envs = [
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
"ollamaApi",
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
]
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
for (const env of envs) {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
if (!process.env[env]) {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
console.error(`[✨ AI | !] ❌ ${env} not set!`)
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
return false
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
}
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
}
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
console.log("[✨ AI] Pre-checks passed\n")
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
return true
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
}
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
async function getResponse(prompt: string, ctx: TextContext, replyGenerating: Message, model: string) {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
const Strings = getStrings(languageCode(ctx))
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
if (!ctx.chat) {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
return {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
success: false,
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
error: Strings.unexpectedErr.replace("{error}", "No chat found"),
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
}
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
}
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
try {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
const aiResponse = await axios.post(
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
`${process.env.ollamaApi}/api/generate`,
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
{
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
model,
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
prompt,
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
stream: true,
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
},
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
{
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
responseType: "stream",
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
}
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
)
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
let fullResponse = ""
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
![]() I'm not sure about what it does, but always prefer to use const whenever it's possible I'm not sure about what it does, but always prefer to use const whenever it's possible
![]() LLMs essentially stream their output, which is fetched through API (done above with the I used let because as the response comes in, LLMs essentially stream their output, which is fetched through API (done above with the `axios.post()`).
I used let because as the response comes in, `fullResponse` contains the latest complete response (it's live updating) which gets edited on Telegram. Hope this clears it up!
|
|||||||
|
let thoughts = ""
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
let lastUpdate = Date.now()
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
const stream = aiResponse.data
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
for await (const chunk of stream) {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
const lines = chunk.toString().split('\n')
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
for (const line of lines) {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
if (!line.trim()) continue
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
let ln
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
try {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
ln = JSON.parse(line)
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
} catch (e) {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
console.error("[✨ AI | !] Error parsing chunk:", e)
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
continue
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
}
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
if (model === thinking_model) {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
if (ln.response.includes('<think>')) {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
const thinkMatch = ln.response.match(/<think>([\s\S]*?)<\/think>/)
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
if (thinkMatch && thinkMatch[1].trim().length > 0) {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
logger.logThinking(ctx.chat.id, replyGenerating.message_id, true)
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
} else if (!thinkMatch) {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
logger.logThinking(ctx.chat.id, replyGenerating.message_id, true)
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
}
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
} else if (ln.response.includes('</think>')) {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
logger.logThinking(ctx.chat.id, replyGenerating.message_id, false)
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
}
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
}
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
const now = Date.now()
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
if (ln.response) {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
if (model === thinking_model) {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
let patchedThoughts = ln.response
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
const thinkTagRx = /<think>([\s\S]*?)<\/think>/g
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
patchedThoughts = patchedThoughts.replace(thinkTagRx, (match, p1) => p1.trim().length > 0 ? '`Thinking...`' + p1 + '`Finished thinking`' : '')
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
patchedThoughts = patchedThoughts.replace(/<think>/g, '`Thinking...`')
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
patchedThoughts = patchedThoughts.replace(/<\/think>/g, '`Finished thinking`')
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
thoughts += patchedThoughts
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
fullResponse += patchedThoughts
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
} else {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
fullResponse += ln.response
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
}
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
if (now - lastUpdate >= 1000) {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
await rateLimiter.editMessageWithRetry(
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
ctx,
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
ctx.chat.id,
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
replyGenerating.message_id,
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
thoughts,
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
{ parse_mode: 'Markdown' }
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
)
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
lastUpdate = now
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
}
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
}
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
}
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
}
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
return {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
success: true,
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
response: fullResponse,
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
}
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
} catch (error: any) {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
let shouldPullModel = false
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
if (error.response) {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
const errData = error.response.data?.error
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
const errStatus = error.response.status
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
if (errData && (errData.includes(`model '${model}' not found`) || errStatus === 404)) {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
shouldPullModel = true
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
} else {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
console.error("[✨ AI | !] Error zone 1:", errData)
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
return { success: false, error: errData }
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
}
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
} else if (error.request) {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
console.error("[✨ AI | !] No response received:", error.request)
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
return { success: false, error: "No response received from server" }
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
} else {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
console.error("[✨ AI | !] Error zone 3:", error.message)
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
return { success: false, error: error.message }
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
}
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
if (shouldPullModel) {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
ctx.telegram.editMessageText(ctx.chat.id, replyGenerating.message_id, undefined, `🔄 Pulling ${model} from ollama...\n\nThis may take a few minutes...`)
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
console.log(`[✨ AI | i] Pulling ${model} from ollama...`)
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
try {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
await axios.post(
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
`${process.env.ollamaApi}/api/pull`,
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
{
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
model,
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
stream: false,
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
timeout: process.env.ollamaApiTimeout || 10000,
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
}
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
)
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
} catch (e: any) {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
if (e.response) {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
console.error("[✨ AI | !] Something went wrong:", e.response.data?.error)
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
return {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
success: false,
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
error: `❌ Something went wrong while pulling ${model}, please try your command again!`,
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
}
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
} else if (e.request) {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
console.error("[✨ AI | !] No response received while pulling:", e.request)
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
return {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
success: false,
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
error: `❌ No response received while pulling ${model}, please try again!`,
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
}
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
} else {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
console.error("[✨ AI | !] Error while pulling:", e.message)
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
return {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
success: false,
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
error: `❌ Error while pulling ${model}: ${e.message}`,
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
}
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
}
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
}
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
console.log(`[✨ AI | i] ${model} pulled successfully`)
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
return {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
success: true,
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
response: `✅ Pulled ${model} successfully, please retry the command.`,
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
}
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
}
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
}
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
}
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
export default (bot: Telegraf<Context>) => {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
const botName = bot.botInfo?.first_name && bot.botInfo?.last_name ? `${bot.botInfo.first_name} ${bot.botInfo.last_name}` : "Kowalski"
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
bot.command(["ask", "think"], spamwatchMiddleware, async (ctx) => {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
if (!ctx.message || !('text' in ctx.message)) return
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
const isAsk = ctx.message.text.startsWith("/ask")
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
const model = isAsk ? flash_model : thinking_model
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
const textCtx = ctx as TextContext
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
const reply_to_message_id = replyToMessageId(textCtx)
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
const Strings = getStrings(languageCode(textCtx))
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
const message = textCtx.message.text
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
const author = ("@" + ctx.from?.username) || ctx.from?.first_name
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
logger.logCmdStart(author, model === flash_model ? "ask" : "think")
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
if (!process.env.ollamaApi) {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
await ctx.reply(Strings.aiDisabled, {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
parse_mode: 'Markdown',
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
...({ reply_to_message_id })
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
})
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
return
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
}
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
const replyGenerating = await ctx.reply(Strings.askGenerating.replace("{model}", model), {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
parse_mode: 'Markdown',
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
...({ reply_to_message_id })
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
})
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
const fixedMsg = message.replace(/\/(ask|think) /, "")
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
if (fixedMsg.length < 1) {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
await ctx.reply(Strings.askNoMessage, {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
parse_mode: 'Markdown',
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
...({ reply_to_message_id })
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
})
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
return
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
}
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
logger.logPrompt(fixedMsg)
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
const prompt = sanitizeForJson(
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
`You are a plaintext-only, helpful assistant called ${botName}.
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
Current Date/Time (UTC): ${new Date().toLocaleString()}
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
---
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
Respond to the user's message:
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
${fixedMsg}`)
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
const aiResponse = await getResponse(prompt, textCtx, replyGenerating, model)
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
if (!aiResponse) return
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
if (!ctx.chat) return
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
if (aiResponse.success && aiResponse.response) {
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
await rateLimiter.editMessageWithRetry(
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
ctx,
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
ctx.chat.id,
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
replyGenerating.message_id,
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
aiResponse.response,
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
{ parse_mode: 'Markdown' }
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
)
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
return
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
}
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
const error = Strings.unexpectedErr.replace("{error}", aiResponse.error)
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
await rateLimiter.editMessageWithRetry(
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
ctx,
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
ctx.chat.id,
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
replyGenerating.message_id,
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
error,
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
{ parse_mode: 'Markdown' }
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
)
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
})
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|||||||
|
}
|
||||||
![]() Don't use axios like this, check https://axios-http.com/docs/instance Don't use axios like this, check https://axios-http.com/docs/instance
![]() Why are you printing p1? Why are you printing p1?
![]() There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;) There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)
![]() I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read I like this idea! I will look into cleaning it up, and maybe break some things into functions so the code is easier to read
|
|
@ -32,7 +32,8 @@ async function sendHelpMessage(ctx, isEditing) {
|
||||||
[{ text: Strings.mainCommands, callback_data: 'helpMain' }, { text: Strings.usefulCommands, callback_data: 'helpUseful' }],
|
[{ text: Strings.mainCommands, callback_data: 'helpMain' }, { text: Strings.usefulCommands, callback_data: 'helpUseful' }],
|
||||||
[{ text: Strings.interactiveEmojis, callback_data: 'helpInteractive' }, { text: Strings.funnyCommands, callback_data: 'helpFunny' }],
|
[{ text: Strings.interactiveEmojis, callback_data: 'helpInteractive' }, { text: Strings.funnyCommands, callback_data: 'helpFunny' }],
|
||||||
[{ text: Strings.lastFm.helpEntry, callback_data: 'helpLast' }, { text: Strings.animalCommands, callback_data: 'helpAnimals' }],
|
[{ text: Strings.lastFm.helpEntry, callback_data: 'helpLast' }, { text: Strings.animalCommands, callback_data: 'helpAnimals' }],
|
||||||
[{ text: Strings.ytDownload.helpEntry, callback_data: 'helpYouTube' }, { text: Strings.ponyApi.helpEntry, callback_data: 'helpMLP' }]
|
[{ text: Strings.ytDownload.helpEntry, callback_data: 'helpYouTube' }, { text: Strings.ponyApi.helpEntry, callback_data: 'helpMLP' }],
|
||||||
|
[{ text: Strings.aiCmds, callback_data: 'helpAi' }]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -112,6 +113,10 @@ export default (bot) => {
|
||||||
await ctx.answerCbQuery();
|
await ctx.answerCbQuery();
|
||||||
await ctx.editMessageText(Strings.ponyApi.helpDesc, options);
|
await ctx.editMessageText(Strings.ponyApi.helpDesc, options);
|
||||||
break;
|
break;
|
||||||
|
case 'helpAi':
|
||||||
|
await ctx.answerCbQuery();
|
||||||
|
await ctx.editMessageText(Strings.aiCmdsDesc, options);
|
||||||
|
break;
|
||||||
case 'helpBack':
|
case 'helpBack':
|
||||||
await ctx.answerCbQuery();
|
await ctx.answerCbQuery();
|
||||||
await sendHelpMessage(ctx, true);
|
await sendHelpMessage(ctx, true);
|
||||||
|
|
|
@ -33,8 +33,8 @@
|
||||||
"funEmojiResult": "*You rolled {emoji} and got* `{value}`*!*\nYou don't know what that means? Me neither!",
|
"funEmojiResult": "*You rolled {emoji} and got* `{value}`*!*\nYou don't know what that means? Me neither!",
|
||||||
"gifErr": "*Something went wrong while sending the GIF. Please try again later.*\n\n{err}",
|
"gifErr": "*Something went wrong while sending the GIF. Please try again later.*\n\n{err}",
|
||||||
"lastFm": {
|
"lastFm": {
|
||||||
"helpEntry": "Last.fm",
|
"helpEntry": "🎵 Last.fm",
|
||||||
"helpDesc": "*Last.fm*\n\n- /lt | /lmu | /last | /lfm: Shows the last song from your Last.fm profile + the number of plays.\n- /setuser `<user>`: Sets the user for the command above.",
|
"helpDesc": "🎵 *Last.fm*\n\n- /lt | /lmu | /last | /lfm: Shows the last song from your Last.fm profile + the number of plays.\n- /setuser `<user>`: Sets the user for the command above.",
|
||||||
"noUser": "*Please provide a Last.fm username.*\nExample: `/setuser <username>`",
|
"noUser": "*Please provide a Last.fm username.*\nExample: `/setuser <username>`",
|
||||||
"noUserSet": "*You haven't set your Last.fm username yet.*\nUse the command /setuser to set.\n\nExample: `/setuser <username>`",
|
"noUserSet": "*You haven't set your Last.fm username yet.*\nUse the command /setuser to set.\n\nExample: `/setuser <username>`",
|
||||||
"noRecentTracks": "*No recent tracks found for Last.fm user* `{lastfmUser}`*.*",
|
"noRecentTracks": "*No recent tracks found for Last.fm user* `{lastfmUser}`*.*",
|
||||||
|
@ -52,25 +52,27 @@
|
||||||
"apiErr": "*An error occurred while retrieving the weather. Please try again later.*\n\n`{error}`",
|
"apiErr": "*An error occurred while retrieving the weather. Please try again later.*\n\n`{error}`",
|
||||||
"apiKeyErr": "*An API key was not set by the bot owner. Please try again later.*"
|
"apiKeyErr": "*An API key was not set by the bot owner. Please try again later.*"
|
||||||
},
|
},
|
||||||
"mainCommands": "Main commands",
|
"mainCommands": "ℹ️ Main Commands",
|
||||||
"mainCommandsDesc": "*Main commands*\n\n- /help: Show bot's help\n- /start: Start the bot\n- /privacy: Read the bot's Privacy Policy",
|
"mainCommandsDesc": "ℹ️ *Main Commands*\n\n- /help: Show bot's help\n- /start: Start the bot\n- /privacy: Read the bot's Privacy Policy",
|
||||||
"usefulCommands": "Useful commands",
|
"usefulCommands": "🛠️ Useful Commands",
|
||||||
"usefulCommandsDesc": "*Useful commands*\n\n- /chatinfo: Send information about the group\n- /userinfo: Send information about yourself\n- /d | /device `<model>`: Search for a device on GSMArena and show its specs.\n/codename | /whatis `<device codename>`: Shows what device is based on the codename. Example: `/codename begonia`\n- /weather | /clima `<city>`: See weather status for a specific location.\n- /modarchive | /tma `<module id>`: Download a module from The Mod Archive.\n- /http `<HTTP code>`: Send details about a specific HTTP code. Example: `/http 404`",
|
"usefulCommandsDesc": "🛠️ *Useful commands*\n\n- /chatinfo: Send information about the group\n- /userinfo: Send information about yourself\n- /d | /device `<model>`: Search for a device on GSMArena and show its specs.\n/codename | /whatis `<device codename>`: Shows what device is based on the codename. Example: `/codename begonia`\n- /weather | /clima `<city>`: See weather status for a specific location.\n- /modarchive | /tma `<module id>`: Download a module from The Mod Archive.\n- /http `<HTTP code>`: Send details about a specific HTTP code. Example: `/http 404`",
|
||||||
"funnyCommands": "Funny commands",
|
"funnyCommands": "😂 Funny Commands",
|
||||||
"funnyCommandsDesc": "*Funny commands*\n\n- /gay: Check if you are gay\n- /furry: Check if you are a furry\n- /random: Pick a random number between 0-10",
|
"funnyCommandsDesc": "😂 *Funny Commands*\n\n- /gay: Check if you are gay\n- /furry: Check if you are a furry\n- /random: Pick a random number between 0-10",
|
||||||
"interactiveEmojis": "Interactive emojis",
|
"interactiveEmojis": "🎲 Interactive Emojis",
|
||||||
"interactiveEmojisDesc": "*Interactive emojis*\n\n- /dice: Roll a dice\n- /idice: Infinitely roll a colored dice\n- /slot: Try to combine the figures!\n- /ball: Try to kick the ball into the goal!\n- /bowling: Try to hit the pins!\n- /dart: Try to hit the target!",
|
"interactiveEmojisDesc": "🎲 *Interactive emojis*\n\n- /dice: Roll a dice\n- /idice: Infinitely roll a colored dice\n- /slot: Try to combine the figures!\n- /ball: Try to kick the ball into the goal!\n- /bowling: Try to hit the pins!\n- /dart: Try to hit the target!",
|
||||||
"animalCommands": "Animals",
|
"animalCommands": "🐱 Animals",
|
||||||
"animalCommandsDesc": "*Animals*\n\n- /soggy | /soggycat `<1 | 2 | 3 | 4 | orig | thumb | sticker | alt>`: Sends the [Soggy cat meme](https://knowyourmeme.com/memes/soggy-cat)\n- /cat: Sends a random picture of a cat.\n- /fox: Sends a random picture of a fox.\n- /duck: Sends a random picture of a duck.\n- /dog: Sends a random picture of a dog.\n- /httpcat `<http code>`: Send cat memes from http.cat with your specified HTTP code. Example: `/httpcat 404`",
|
"animalCommandsDesc": "🐱 *Animals*\n\n- /soggy | /soggycat `<1 | 2 | 3 | 4 | orig | thumb | sticker | alt>`: Sends the [Soggy cat meme](https://knowyourmeme.com/memes/soggy-cat)\n- /cat: Sends a random picture of a cat.\n- /fox: Sends a random picture of a fox.\n- /duck: Sends a random picture of a duck.\n- /dog: Sends a random picture of a dog.\n- /httpcat `<http code>`: Send cat memes from http.cat with your specified HTTP code. Example: `/httpcat 404`",
|
||||||
|
"aiCmds": "✨ AI Commands",
|
||||||
|
"aiCmdsDesc": "✨ *AI Commands*\n\n- /ask `<prompt>`: Ask a question to an AI",
|
||||||
"maInvalidModule": "Please provide a valid module ID from The Mod Archive.\nExample: `/modarchive 81574`",
|
"maInvalidModule": "Please provide a valid module ID from The Mod Archive.\nExample: `/modarchive 81574`",
|
||||||
"maDownloadError": "Error downloading the file. Check the module ID and try again.",
|
"maDownloadError": "Error downloading the file. Check the module ID and try again.",
|
||||||
"ytDownload": {
|
"ytDownload": {
|
||||||
"helpEntry": "Video download",
|
"helpEntry": "📺 YouTube Download",
|
||||||
"helpDesc": "*Video download*\n\n- /yt | /ytdl | /sdl | /dl | /video `<video link>`: Download a video from some platforms (e.g. YouTube, Instagram, Facebook, etc.).\n\n See [this link](https://github.com/yt-dlp/yt-dlp/blob/master/supportedsites.md) for more information and which services are supported.\n\n*Note: Telegram is currently limiting bot uploads to 50MB, which means that if the video you want to download is larger than 50MB, the quality will be reduced to try to upload it anyway. We're trying our best to work around or fix this problem.*",
|
"helpDesc": "📺 *YouTube Download*\n\n- /yt | /ytdl | /sdl | /dl | /video `<video link>`: Download a video from some platforms (e.g. YouTube, Instagram, Facebook, etc.).\n\n See [this link](https://github.com/yt-dlp/yt-dlp/blob/master/supportedsites.md) for more information and which services are supported.\n\n*Note: Telegram is currently limiting bot uploads to 50MB, which means that if the video you want to download is larger than 50MB, the quality will be reduced to try to upload it anyway. We're trying our best to work around or fix this problem.*",
|
||||||
"downloadingVid": "*Downloading video...*",
|
"downloadingVid": "⬇️ *Downloading video...*",
|
||||||
"libNotFound": "*It seems that the yt-dlp executable does not exist on our server...\n\nIn that case, the problem is on our end! Please wait until we have noticed and solved the problem.*",
|
"libNotFound": "*It seems that the yt-dlp executable does not exist on our server...\n\nIn that case, the problem is on our end! Please wait until we have noticed and solved the problem.*",
|
||||||
"checkingSize": "*Checking if the video exceeds the 50MB limit...*",
|
"checkingSize": "🔎 *Checking if the video exceeds the 50MB limit...*",
|
||||||
"uploadingVid": "*Uploading video...*",
|
"uploadingVid": "⬆️ *Uploading video...*",
|
||||||
"msgDesc": "{userMention}*, there is your downloaded video.*",
|
"msgDesc": "{userMention}*, there is your downloaded video.*",
|
||||||
"downloadErr": "*Error during YT video download:*\n\n`{err}`",
|
"downloadErr": "*Error during YT video download:*\n\n`{err}`",
|
||||||
"uploadErr": "Error uploading file. Please try again later.",
|
"uploadErr": "Error uploading file. Please try again later.",
|
||||||
|
@ -95,8 +97,8 @@
|
||||||
"resultMsg": "*HTTP Code*: {code}\n*Name*: `{message}`\n*Description*: {description}"
|
"resultMsg": "*HTTP Code*: {code}\n*Name*: `{message}`\n*Description*: {description}"
|
||||||
},
|
},
|
||||||
"ponyApi": {
|
"ponyApi": {
|
||||||
"helpEntry": "My Little Pony",
|
"helpEntry": "🐴 My Little Pony",
|
||||||
"helpDesc": "*My Little Pony*\n\n- /mlp: Displays this help message.\n- /mlpchar `<character name>`: Shows specific information about a My Little Pony character. Example: `/mlpchar Twilight Sparkle`\n- /mlpep: Shows specific information about a My Little Pony episode. Example: `/mlpep 136`\n- /mlpcomic `<comic name>`: Shows specific information about a My Little Pony comic. Example: `/mlpcomic Nightmare Rarity`\n- /rpony | /randompony | /mlpart: Sends a random artwork made by the My Little Pony community.",
|
"helpDesc": "🐴 *My Little Pony*\n\n- /mlp: Displays this help message.\n- /mlpchar `<character name>`: Shows specific information about a My Little Pony character. Example: `/mlpchar Twilight Sparkle`\n- /mlpep: Shows specific information about a My Little Pony episode. Example: `/mlpep 136`\n- /mlpcomic `<comic name>`: Shows specific information about a My Little Pony comic. Example: `/mlpcomic Nightmare Rarity`\n- /rpony | /randompony | /mlpart: Sends a random artwork made by the My Little Pony community.",
|
||||||
"charRes": "*{name} (ID: {id})*\n\n*Alias:* `{alias}`\n*Sex:* `{sex}`\n*Residence:* `{residence}`\n*Occupation:* `{occupation}`\n*Kind:* `{kind}`\n\n*Fandom URL:*\n[{url}]({url})",
|
"charRes": "*{name} (ID: {id})*\n\n*Alias:* `{alias}`\n*Sex:* `{sex}`\n*Residence:* `{residence}`\n*Occupation:* `{occupation}`\n*Kind:* `{kind}`\n\n*Fandom URL:*\n[{url}]({url})",
|
||||||
"epRes": "*{name} (ID: {id})*\n\n*Season:* `{season}`\n*Episode:* `{episode}`\n*Overall Ep.:* `{overall}`\n*Release date:* `{airdate}`\n*Story by:* `{storyby}`\n*Written by:* `{writtenby}`\n*Storyboard:* `{storyboard}`\n\n*Fandom URL:*\n[{url}]({url})",
|
"epRes": "*{name} (ID: {id})*\n\n*Season:* `{season}`\n*Episode:* `{episode}`\n*Overall Ep.:* `{overall}`\n*Release date:* `{airdate}`\n*Story by:* `{storyby}`\n*Written by:* `{writtenby}`\n*Storyboard:* `{storyboard}`\n\n*Fandom URL:*\n[{url}]({url})",
|
||||||
"comicRes": "*{name} (ID: {id})*\n\n*Series:* `{series}`\n*Writer:* `{writer}`\n*Artist:* `{artist}`\n*Colorist:* `{colorist}`\n*Letterer:* `{letterer}`\n*Editor:* `{editor}`\n\n*Fandom URL:*\n[{url}]({url})",
|
"comicRes": "*{name} (ID: {id})*\n\n*Series:* `{series}`\n*Writer:* `{writer}`\n*Artist:* `{artist}`\n*Colorist:* `{colorist}`\n*Letterer:* `{letterer}`\n*Editor:* `{editor}`\n\n*Fandom URL:*\n[{url}]({url})",
|
||||||
|
@ -117,5 +119,7 @@
|
||||||
"apiErr": "An error occurred while fetching data from the API.\n\n`{err}`"
|
"apiErr": "An error occurred while fetching data from the API.\n\n`{err}`"
|
||||||
},
|
},
|
||||||
"chatNotFound": "Chat not found.",
|
"chatNotFound": "Chat not found.",
|
||||||
"noFileProvided": "Please provide a file to send."
|
"noFileProvided": "Please provide a file to send.",
|
||||||
|
"askGenerating": "✨ _{model} is working..._",
|
||||||
|
"aiDisabled": "AI features are currently disabled"
|
||||||
}
|
}
|
|
@ -62,6 +62,8 @@
|
||||||
"interactiveEmojisDesc": "*Emojis interativos*\n\n- /dice: Jogue um dado\n- /idice: Role infinitamente um dado colorido\n- /slot: Tente combinar as figuras!\n- /ball: Tente chutar a bola no gol!\n- /bowling: Tente derrubar os pinos!\n- /dart: Tente acertar o alvo!",
|
"interactiveEmojisDesc": "*Emojis interativos*\n\n- /dice: Jogue um dado\n- /idice: Role infinitamente um dado colorido\n- /slot: Tente combinar as figuras!\n- /ball: Tente chutar a bola no gol!\n- /bowling: Tente derrubar os pinos!\n- /dart: Tente acertar o alvo!",
|
||||||
"animalCommands": "Animais",
|
"animalCommands": "Animais",
|
||||||
"animalCommandsDesc": "*Animais*\n\n- /soggy | /soggycat `<1 | 2 | 3 | 4 | orig | thumb | sticker | alt>`: Envia o [meme do gato encharcado](https://knowyourmeme.com/memes/soggy-cat)\n- /cat - Envia uma foto aleatória de um gato.\n- /fox - Envia uma foto aleatória de uma raposa.\n- /duck - Envia uma foto aleatória de um pato.\n- /dog - Envia uma imagem aleatória de um cachorro.\n- /httpcat `<código http>`: Envia memes de gato do http.cat com o código HTTP especificado. Exemplo: `/httpcat 404`",
|
"animalCommandsDesc": "*Animais*\n\n- /soggy | /soggycat `<1 | 2 | 3 | 4 | orig | thumb | sticker | alt>`: Envia o [meme do gato encharcado](https://knowyourmeme.com/memes/soggy-cat)\n- /cat - Envia uma foto aleatória de um gato.\n- /fox - Envia uma foto aleatória de uma raposa.\n- /duck - Envia uma foto aleatória de um pato.\n- /dog - Envia uma imagem aleatória de um cachorro.\n- /httpcat `<código http>`: Envia memes de gato do http.cat com o código HTTP especificado. Exemplo: `/httpcat 404`",
|
||||||
|
"aiCmds": "Comandos de IA",
|
||||||
|
"aiCmdsDesc": "*Comandos de IA*\n\n- /ask `<prompt>`: Fazer uma pergunta a uma IA",
|
||||||
"maInvalidModule": "Por favor, forneça um ID de módulo válido do The Mod Archive.\nExemplo: `/modarchive 81574`",
|
"maInvalidModule": "Por favor, forneça um ID de módulo válido do The Mod Archive.\nExemplo: `/modarchive 81574`",
|
||||||
"maDownloadError": "Erro ao baixar o arquivo. Verifique o ID do módulo e tente novamente.",
|
"maDownloadError": "Erro ao baixar o arquivo. Verifique o ID do módulo e tente novamente.",
|
||||||
"ytDownload": {
|
"ytDownload": {
|
||||||
|
@ -115,5 +117,8 @@
|
||||||
"notFound": "Celular não encontrado.",
|
"notFound": "Celular não encontrado.",
|
||||||
"resultMsg": "*Nome:* `{name}`\n*Marca:* `{brand}`\n*Modelo:* `{model}`\n*Codinome:* `{codename}`",
|
"resultMsg": "*Nome:* `{name}`\n*Marca:* `{brand}`\n*Modelo:* `{model}`\n*Codinome:* `{codename}`",
|
||||||
"apiErr": "Ocorreu um erro ao buscar os dados da API.\n\n`{err}`"
|
"apiErr": "Ocorreu um erro ao buscar os dados da API.\n\n`{err}`"
|
||||||
}
|
},
|
||||||
|
"noFileProvided": "Por favor, forneça um arquivo para envio.",
|
||||||
|
"askGenerating": "✨ _{modelo} está funcionando..._",
|
||||||
|
"aiDisabled": "Os recursos de IA estão desativados no momento"
|
||||||
}
|
}
|
||||||
|
|
83
src/utils/log.ts
Normal file
|
@ -0,0 +1,83 @@
|
||||||
|
// LOG.TS
|
||||||
|
// by ihatenodejs/Aidan
|
||||||
|
//
|
||||||
|
// -----------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// This is free and unencumbered software released into the public domain.
|
||||||
|
//
|
||||||
|
// Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||||
|
// distribute this software, either in source code form or as a compiled
|
||||||
|
// binary, for any purpose, commercial or non-commercial, and by any
|
||||||
|
// means.
|
||||||
|
//
|
||||||
|
// In jurisdictions that recognize copyright laws, the author or authors
|
||||||
|
// of this software dedicate any and all copyright interest in the
|
||||||
|
// software to the public domain. We make this dedication for the benefit
|
||||||
|
// of the public at large and to the detriment of our heirs and
|
||||||
|
// successors. We intend this dedication to be an overt act of
|
||||||
|
// relinquishment in perpetuity of all present and future rights to this
|
||||||
|
// software under copyright law.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
// IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||||
|
// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||||
|
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
//
|
||||||
|
// For more information, please refer to <https://unlicense.org/>
|
||||||
|
|
||||||
|
import { flash_model, thinking_model } from "../commands/ai"
|
||||||
|
|
||||||
|
class Logger {
|
||||||
|
private static instance: Logger
|
||||||
|
|
||||||
|
private constructor() {}
|
||||||
|
|
||||||
|
static getInstance(): Logger {
|
||||||
|
if (!Logger.instance) {
|
||||||
|
Logger.instance = new Logger()
|
||||||
|
}
|
||||||
|
return Logger.instance
|
||||||
|
}
|
||||||
|
|
||||||
|
logCmdStart(user: string, type: "ask" | "think"): void {
|
||||||
|
console.log(`\n[✨ AI | START] Received /${type} for model ${type === "ask" ? flash_model : thinking_model}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
logThinking(chatId: number, messageId: number, thinking: boolean): void {
|
||||||
|
if (thinking) {
|
||||||
|
console.log(`[✨ AI | THINKING | ${chatId}:${messageId}] Model started thinking`)
|
||||||
|
} else {
|
||||||
|
console.log(`[✨ AI | THINKING | ${chatId}:${messageId}] Model stopped thinking`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
logChunk(chatId: number, messageId: number, text: string, isOverflow: boolean = false): void {
|
||||||
|
const prefix = isOverflow ? "[✨ AI | OVERFLOW]" : "[✨ AI | CHUNK]"
|
||||||
|
console.log(`${prefix} [${chatId}:${messageId}] ${text.length} chars pushed to Telegram`)
|
||||||
|
}
|
||||||
|
|
||||||
|
logPrompt(prompt: string): void {
|
||||||
|
console.log(`[✨ AI | PROMPT] ${prompt.length} chars input`)
|
||||||
|
}
|
||||||
|
|
||||||
|
logError(error: any): void {
|
||||||
|
if (error.response?.error_code === 429) {
|
||||||
|
const retryAfter = error.response.parameters?.retry_after || 1
|
||||||
|
console.error(`[✨ AI | RATE_LIMIT] Too Many Requests - retry after ${retryAfter}s`)
|
||||||
|
} else if (error.response?.error_code === 400 && error.response?.description?.includes("can't parse entities")) {
|
||||||
|
console.error("[✨ AI | PARSE_ERROR] Markdown parsing failed, retrying with plain text")
|
||||||
|
} else {
|
||||||
|
const errorDetails = {
|
||||||
|
code: error.response?.error_code,
|
||||||
|
description: error.response?.description,
|
||||||
|
method: error.on?.method
|
||||||
|
}
|
||||||
|
console.error("[✨ AI | ERROR]", JSON.stringify(errorDetails, null, 2))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const logger = Logger.getInstance()
|
246
src/utils/rate-limiter.ts
Normal file
|
@ -0,0 +1,246 @@
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
// RATE-LIMITER.TS
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
// by ihatenodejs/Aidan
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
//
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
// -----------------------------------------------------------------------
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
//
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
// This is free and unencumbered software released into the public domain.
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
//
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
// Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
// distribute this software, either in source code form or as a compiled
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
// binary, for any purpose, commercial or non-commercial, and by any
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
// means.
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
//
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
// In jurisdictions that recognize copyright laws, the author or authors
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
// of this software dedicate any and all copyright interest in the
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
// software to the public domain. We make this dedication for the benefit
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
// of the public at large and to the detriment of our heirs and
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
// successors. We intend this dedication to be an overt act of
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
// relinquishment in perpetuity of all present and future rights to this
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
// software under copyright law.
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
//
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
// IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
//
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
// For more information, please refer to <https://unlicense.org/>
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
import { Context } from 'telegraf'
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
import { logger } from './log'
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
class RateLimiter {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
private lastEditTime: number = 0
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
private readonly minInterval: number = 5000
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
private pendingUpdates: Map<string, string> = new Map()
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
private updateQueue: Map<string, NodeJS.Timeout> = new Map()
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
private readonly max_msg_length: number = 3500
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
private overflowMessages: Map<string, number> = new Map()
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
private isRateLimited: boolean = false
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
private rateLimitEndTime: number = 0
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
private getMessageKey(chatId: number, messageId: number): string {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
return `${chatId}:${messageId}`
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
}
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
private async waitForRateLimit(chatId: number, messageId: number): Promise<void> {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
if (!this.isRateLimited) return
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
console.log(`[✨ AI | RATELIMIT] [${chatId}:${messageId}] Ratelimited, waiting for end of ${this.rateLimitEndTime - Date.now()}ms`)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
const now = Date.now()
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
if (now < this.rateLimitEndTime) {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
await new Promise(resolve => setTimeout(resolve, this.rateLimitEndTime - now))
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
}
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
this.isRateLimited = false
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
}
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
private chunkText(text: string): string[] {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
const chunks: string[] = []
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
let currentChunk = ''
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
let currentLength = 0
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
const lines = text.split('\n')
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
for (const line of lines) {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
if (currentLength + line.length + 1 > this.max_msg_length) {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
if (currentChunk) {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
chunks.push(currentChunk)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
currentChunk = ''
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
currentLength = 0
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
}
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
if (line.length > this.max_msg_length) {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
for (let i = 0; i < line.length; i += this.max_msg_length) {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
chunks.push(line.substring(i, i + this.max_msg_length))
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
}
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
} else {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
currentChunk = line
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
currentLength = line.length
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
}
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
} else {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
if (currentChunk) {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
currentChunk += '\n'
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
currentLength++
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
}
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
currentChunk += line
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
currentLength += line.length
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
}
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
}
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
if (currentChunk) {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
chunks.push(currentChunk)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
}
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
return chunks
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
}
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
private handleTelegramError(error: unknown, messageKey: string, options: any, ctx: Context, chatId: number, messageId: number): boolean {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
if (!isTelegramError(error)) return false
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
if (error.response.error_code === 429) {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
const retryAfter = error.response.parameters?.retry_after || 1
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
this.isRateLimited = true
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
this.rateLimitEndTime = Date.now() + (retryAfter * 1000)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
const existingTimeout = this.updateQueue.get(messageKey)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
if (existingTimeout) clearTimeout(existingTimeout)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
const timeout = setTimeout(() => {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
this.processUpdate(ctx, chatId, messageId, options)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
}, retryAfter * 1000)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
this.updateQueue.set(messageKey, timeout)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
return true
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
}
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
if (error.response.error_code === 400) {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
if (error.response.description?.includes("can't parse entities") || error.response.description?.includes("MESSAGE_TOO_LONG")) {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
const plainOptions = { ...options, parse_mode: undefined }
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
this.processUpdate(ctx, chatId, messageId, plainOptions)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
return true
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
}
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
if (error.response.description?.includes("message is not modified")) {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
this.pendingUpdates.delete(messageKey)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
this.updateQueue.delete(messageKey)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
return true
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
}
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
logger.logError(error)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
this.pendingUpdates.delete(messageKey)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
this.updateQueue.delete(messageKey)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
return true
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
}
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
logger.logError(error)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
this.pendingUpdates.delete(messageKey)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
this.updateQueue.delete(messageKey)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
return true
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
}
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
private async processUpdate(
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
ctx: Context,
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
chatId: number,
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
messageId: number,
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
options: any
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
): Promise<void> {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
const messageKey = this.getMessageKey(chatId, messageId)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
const latestText = this.pendingUpdates.get(messageKey)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
if (!latestText) return
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
const now = Date.now()
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
const timeSinceLastEdit = now - this.lastEditTime
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
await this.waitForRateLimit(chatId, messageId)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
if (timeSinceLastEdit < this.minInterval) {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
const existingTimeout = this.updateQueue.get(messageKey)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
if (existingTimeout) clearTimeout(existingTimeout)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
const timeout = setTimeout(() => {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
this.processUpdate(ctx, chatId, messageId, options)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
}, this.minInterval - timeSinceLastEdit)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
this.updateQueue.set(messageKey, timeout)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
return
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
}
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
try {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
if (latestText.length > this.max_msg_length) {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
const chunks = this.chunkText(latestText)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
const firstChunk = chunks[0]
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
logger.logChunk(chatId, messageId, firstChunk)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
try {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
await ctx.telegram.editMessageText(chatId, messageId, undefined, firstChunk, options)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
} catch (error: unknown) {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
if (
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
isTelegramError(error) &&
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
!error.response.description?.includes("message is not modified")
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
) {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
throw error
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
}
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
}
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
for (let i = 1; i < chunks.length; i++) {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
const chunk = chunks[i]
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
const overflowMessageId = this.overflowMessages.get(messageKey)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
if (overflowMessageId) {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
try {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
await ctx.telegram.editMessageText(chatId, overflowMessageId, undefined, chunk, options)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
logger.logChunk(chatId, overflowMessageId, chunk, true)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
} catch (error: unknown) {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
if (
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
isTelegramError(error) &&
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
!error.response.description?.includes("message is not modified")
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
) {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
throw error
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
}
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
}
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
} else {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
const newMessage = await ctx.telegram.sendMessage(chatId, chunk, {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
...options,
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
reply_to_message_id: messageId
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
})
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
logger.logChunk(chatId, newMessage.message_id, chunk, true)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
this.overflowMessages.set(messageKey, newMessage.message_id)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
}
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
}
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
this.pendingUpdates.set(messageKey, firstChunk)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
if (chunks.length > 1) {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
this.pendingUpdates.set(
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
this.getMessageKey(chatId, this.overflowMessages.get(messageKey)!),
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
chunks[chunks.length - 1]
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
}
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
} else {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
logger.logChunk(chatId, messageId, latestText)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
try {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
await ctx.telegram.editMessageText(chatId, messageId, undefined, latestText, options)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
} catch (error: unknown) {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
if (
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
isTelegramError(error) &&
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
!error.response.description?.includes("message is not modified")
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
) {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
throw error
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
}
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
}
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
this.pendingUpdates.delete(messageKey)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
}
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
this.lastEditTime = Date.now()
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
this.updateQueue.delete(messageKey)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
} catch (error: unknown) {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
if (!this.handleTelegramError(error, messageKey, options, ctx, chatId, messageId)) {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
logger.logError(error)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
this.pendingUpdates.delete(messageKey)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
this.updateQueue.delete(messageKey)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
}
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
}
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
}
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
async editMessageWithRetry(
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
ctx: Context,
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
chatId: number,
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
messageId: number,
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
text: string,
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
options: any
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
): Promise<void> {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
const messageKey = this.getMessageKey(chatId, messageId)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
this.pendingUpdates.set(messageKey, text)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
await this.processUpdate(ctx, chatId, messageId, options)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
}
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
}
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
export const rateLimiter = new RateLimiter()
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
function isTelegramError(error: unknown): error is { response: { description?: string, error_code?: number, parameters?: { retry_after?: number } } } {
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
return (
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
typeof error === "object" &&
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
error !== null &&
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
"response" in error &&
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
typeof (error as any).response === "object"
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
)
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
|||||||
|
}
|
||||||
![]() pls, avoid to set any as a type pls, avoid to set any as a type
|
Don't use axios like this, check https://axios-http.com/docs/instance
Why are you printing p1?
There are too many ifs and elses, not only in this file but others too. Maybe we could separate them soon. let's try to do this in the future ;)