Simple Telegram bot integration to OpenAI ChatGPT API
Disclaimer
⚠️ This code represents a working instance of the bot named @net_nebot on Telegram. Other bots may be running the same code, and may be used for malicious purposes. Use at your own risk!
This is not an official OpenAI nor Telegram product. This is a community project.
The code is provided as is, and is not guaranteed to work.
Self-hosting
The easiest way to self-host the bot is to build a Docker image and run it on a server of your choice. The Dockerfile is provided in the repository.
You will need to provide the following arguments to the build command:
docker build -t telegram-chatgpt-bot . \
--build-arg OPENAI_TOKEN=<required, your_api_token> \
--build-arg BOT_TOKEN=<required, your_bot_token> \
--build-arg CHATGPT_VERSION=<optional, 3.5 | 4>
You can also run the bot locally
docker run -d --restart always --name telegram-chatgpt-bot telegram-chatgpt-bot
Translations
The bot is currently available in the following languages: English, Russian, Belarusian, Ukrainian. Feel free to contribute translations for other languages! The ChatGPT API itself understands a lot more languages, so go give it a try!
build(deps): bump github.com/sashabaranov/go-openai from 1.12.0 to 1.13.0
Bumps github.com/sashabaranov/go-openai from 1.12.0 to 1.13.0.
Release notes
Sourced from github.com/sashabaranov/go-openai's releases.
Commits
619ad71
docs: added instructions for obtaining OpenAI API key to README (#421)5c7d882
Allow embeddings requests to be tokens or strings (#417)2042608
docs: remove medatada in PULL_REQUEST_TEMPLATE.md (#423)177c143
Fix OpenAI error when properties is empty in function call : object schema mi...1efcf2d
fix: move pull request template (#420)9c99f36
replace deprecated FunctionDefine in chat_test.go (#416)86d0f48
chore: add a pull request template (#412)581f70b
chore: add an issue template for bug report (#408)a3c0b36
chore: add an issue template for feature request (#410)Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)build(deps): bump github.com/sashabaranov/go-openai from 1.11.2 to 1.11.3
Bumps github.com/sashabaranov/go-openai from 1.11.2 to 1.11.3.
Release notes
Sourced from github.com/sashabaranov/go-openai's releases.
Commits
ffa7abc
Update README.md (#399)e19b074
docs: add requires go version in README.md (#397)f22da8a
feat: allow more input types to functions, fix tests (#377)e948150
fix: chat stream returns an error response with a 'data: ' prefix (#396)7203770
feat: added function call info to chat completions (#390)68f9ef9
split integration test using go build tag (#392)b095938
extract and split integration tests (#389)e49d771
support for parsing error response message fields even if they are arrays (#3...Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)build(deps): bump github.com/sashabaranov/go-openai from 1.10.1 to 1.11.1
Bumps github.com/sashabaranov/go-openai from 1.10.1 to 1.11.1.
Release notes
Sourced from github.com/sashabaranov/go-openai's releases.
Commits
0bd14f9
refactor: ChatCompletionStreamChoice.FinishReason from string to FinishReason...43de771
Create FUNDING.yml (#371)2bd65aa
feat(chat): support function call api (#369)7e76a68
Add 16k 0613 model (#365)646989c
Improve (#356) to support registration of wildcard URLs (#359)3f4e3bb
models: add *-0613 models (#361)b616090
refactoring tests with mock servers (#30) (#356)a243e73
Support Retrieve file content API (#347) (#348)Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)build(deps): bump golang.org/x/sys from 0.8.0 to 0.9.0
Bumps golang.org/x/sys from 0.8.0 to 0.9.0.
Commits
55b11dc
unix: remove recently introduced debug/elf dependency5059a07
unix: implement Ptrace{Set,Get}Regs using PTRACE_{GET,SET}REGSET for Linux304f187
unix: replace use of strcpy in mkerrors.sh81c8a6c
unix: add Getresuid and Getresgid for OpenBSDff98eae
unix: remove absolute path of pwd from mkall.shb52f544
unix: add Getresuid, Getresgid for linuxb5c7a09
unix: update BPF constants with Linux kernel 6.2c8ea6b0
windows: fix EnumProcesses to pass the correct array size352d833
cpu: add test for IsBigEndianc43fe1e
cpu: define IsBigEndian on wasmDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)build(deps): bump github.com/sashabaranov/go-openai from 1.9.5 to 1.10.0
Bumps github.com/sashabaranov/go-openai from 1.9.5 to 1.10.0.
Release notes
Sourced from github.com/sashabaranov/go-openai's releases.
Commits
6830e00
Support Retrieve model API (#340) (#341)1394329
move error_accumulator into internal pkg (#304) (#335)fa694c6
Implement optional io.Reader in AudioRequest (#303) (#265) (#331)61ba5f3
move request_builder into internal pkg (#304) (#329)Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)build(deps): bump github.com/sirupsen/logrus from 1.9.0 to 1.9.1
Bumps github.com/sirupsen/logrus from 1.9.0 to 1.9.1.
Commits
b30aa27
Merge pull request #1339 from xieyuschen/patch-16acd903
Merge pull request #1376 from ozfive/master105e63f
Merge pull request #1 from ashmckenzie/ashmckenzie/fix-writer-scannerc052ba6
Scan text in 64KB chunkse59b167
Merge pull request #1372 from tommyblue/syslog_different_loglevels766cfec
This commit fixes a potential denial of service vulnerability in logrus.Write...70234da
Add instructions to use different log levels for local and sysloga448f82
Merge pull request #1362 from FrancoisWagner/fix-data-race-in-hooks-test-pkgff07b25
Fix data race in hooks.test packaged8787af
Use text when shows the logrus outputDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)build(deps): bump github.com/sashabaranov/go-openai from 1.7.0 to 1.8.0
Bumps github.com/sashabaranov/go-openai from 1.7.0 to 1.8.0.
Release notes
Sourced from github.com/sashabaranov/go-openai's releases.
Commits
061c97e
Implement Unmarshaller interface. Resolves #244 (#248)d94c5e7
Test request builder + streams (#242)9a1ecf5
Add more tests (#241)Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)build(deps): bump golang.org/x/net from 0.13.0 to 0.14.0
Bumps golang.org/x/net from 0.13.0 to 0.14.0.
Commits
c8c0290
go.mod: update golang.org/x dependencies0b21d06
quic: framework for testing blocking operations4648651
quic: add -vv flag for more verbose tests60ae793
quic: don't send session ticketsa7da556
http2: optimize buffer allocation in transport167593b
quic: create and accept streamsDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)build(deps): bump golang.org/x/sys from 0.10.0 to 0.11.0
⚠️ Dependabot is rebasing this PR ⚠️
Rebasing might not happen immediately, so don't worry if this takes some time.
Note: if you make any changes to this PR yourself, they will take precedence over the rebase.
Bumps golang.org/x/sys from 0.10.0 to 0.11.0.
Commits
104d401
unix: add riscv_hwprobe for riscv6470f4e40
unix: retry fetching of lists through sysctl if the size changesad7130c
unix: add more block device ioctl numbersc406141
all: fix some typos25d0004
unix: fix last argument of pselect6 on linux706fa98
windows: remove repetitive words3fead03
unix: add Mremap for netbsdDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)build(deps): bump golang.org/x/net from 0.12.0 to 0.13.0
Bumps golang.org/x/net from 0.12.0 to 0.13.0.
Commits
8ffa475
html: only render content literally in the HTML namespace63fe334
quic: gate and queue synchronization primitivesbd8ac9e
quic: fill out connection id handling08001cc
quic: debug logging of packetsdd0aa33
quic: tls handshake5e678bb
quic: CRYPTO stream handlingdd5bc96
internal/quic: deflake TestConnTestConnd0912d4
quic: add pipe type8db2ead
quic: transport parameter encoding and decoding0adcadf
quic: send and receive datagramsDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)build(deps): bump github.com/sashabaranov/go-openai from 1.14.0 to 1.14.1
Bumps github.com/sashabaranov/go-openai from 1.14.0 to 1.14.1.
Release notes
Sourced from github.com/sashabaranov/go-openai's releases.
Commits
1153eb2
Add support for azure openai new version API (2023-07-01-preview) (#451)1876e0c
update to json.RawMessage (#441)0234c1e
add example: fine tune (#438)e22a29d
Check if the model param is valid for moderations endpoint (#437)39b2acb
ci: set up closing-inactive-issues in GitHub Action (129) (#428)Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)build(deps): bump github.com/sashabaranov/go-openai from 1.14.1 to 1.14.2
Bumps github.com/sashabaranov/go-openai from 1.14.1 to 1.14.2.
Release notes
Sourced from github.com/sashabaranov/go-openai's releases.
Commits
a14bc10
docs: Add Contributing Guidelines (#463)3456989
Compatible with the 2023-07-01-preview API interface of Azure Openai, when co...71a2493
docs: add Frequently Asked Questions to README.md (#462)62dc817
feat: make finish reason nullable in json marshal (#449)Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot show <dependency name> ignore conditions
will show all of the ignore conditions of the specified dependency@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)