Skip to content

Commit c950a26

Browse files
committed
init
0 parents  commit c950a26

File tree

11 files changed

+480
-0
lines changed

11 files changed

+480
-0
lines changed

.github/workflows/build.yaml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Build
2+
on: [push, pull_request]
3+
jobs:
4+
build:
5+
name: Build
6+
runs-on: ${{ matrix.os }}
7+
8+
strategy:
9+
matrix:
10+
os: [ubuntu-latest, windows-latest, macos-latest]
11+
goarch: [amd64, arm64]
12+
exclude:
13+
- os: windows-latest
14+
goarch: arm64
15+
16+
steps:
17+
- name: Check out source code
18+
uses: actions/checkout@v3
19+
- name: Setup
20+
uses: actions/setup-go@v3
21+
with:
22+
go-version-file: "go.mod"
23+
cache: true
24+
- name: Build
25+
run: env GOARCH=${{ matrix.goarch }} make

.github/workflows/release.yaml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
on:
2+
release:
3+
types: [created]
4+
5+
jobs:
6+
releases-matrix:
7+
name: Release Go Binary
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
goos: [linux, windows, darwin]
12+
goarch: [amd64, arm64]
13+
exclude:
14+
- goarch: arm64
15+
goos: windows
16+
steps:
17+
- name: Get Release Info
18+
run: |
19+
echo "RELEASE_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
20+
echo "REPOSITORY_NAME=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV
21+
echo "OS_NAME=${{ matrix.goos }}" >> $GITHUB_ENV
22+
- name: Uppercase Darwin
23+
if: matrix.goos == 'darwin'
24+
run: echo "OS_NAME=Darwin" >> $GITHUB_ENV
25+
- name: Uppercase Linux
26+
if: matrix.goos == 'linux'
27+
run: echo "OS_NAME=Linux" >> $GITHUB_ENV
28+
- name: Uppercase Windows
29+
if: matrix.goos == 'windows'
30+
run: echo "OS_NAME=Win" >> $GITHUB_ENV
31+
- uses: actions/checkout@v3
32+
- uses: wangyoucao577/go-release-action@v1.34
33+
with:
34+
md5sum: false
35+
extra_files: README.md LICENSE env.example
36+
goos: ${{ matrix.goos }}
37+
goarch: ${{ matrix.goarch }}
38+
github_token: ${{ secrets.GITHUB_TOKEN }}
39+
goversion: "https://dl.google.com/go/go1.19.3.linux-amd64.tar.gz"
40+
asset_name: "${{ env.REPOSITORY_NAME }}-${{ env.OS_NAME }}-${{ matrix.goarch }}"

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.env
2+
vendor

.vscode/launch.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Launch Package",
9+
"type": "go",
10+
"request": "launch",
11+
"mode": "auto",
12+
"program": "${fileDirname}"
13+
}
14+
]
15+
}

LICENSE

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
MIT License
2+
3+
Copyright (c) Miguel Piedrafita
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6+
7+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8+
9+
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 OR COPYRIGHT HOLDERS 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.

Makefile

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
GIT_COMMIT=$(shell git describe --always)
2+
3+
.PHONY: all build clean test
4+
5+
all: build
6+
default: build
7+
8+
build:
9+
go build
10+
11+
clean:
12+
rm chatgpt-telegram

README.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# ChatGPT-bot
2+
3+
> Interact with ChatGPT
4+
5+
Go CLI to fuels a Telegram bot that lets you interact with [ChatGPT](https://openai.com/blog/chatgpt/), a large language model trained by OpenAI.
6+
7+
## Installation
8+
9+
Download the file corresponding to your OS in the [releases page](https://github.com/m1guelpf/chatgpt-telegram/releases/latest). After you extract it, copy `env.example` to `.env` and fill in your Bot's details (you'll need your bot token, which you can find [here](https://core.telegram.org/bots/tutorial#obtain-your-bot-token), and optionally your telegram id, which you can find by DMing @userinfobot on Telegram.
10+
11+
## Usage
12+
13+
Run the `chatgpt-telegram` binary!
14+
15+
## License
16+
17+
This repository is licensed under the [MIT License](LICENSE).

env.example

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
TELEGRAM_ID=
2+
TELEGRAM_TOKEN=

go.mod

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module github.com/m1guelpf/chatgpt-telegram
2+
3+
go 1.19
4+
5+
require (
6+
github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.1
7+
github.com/joho/godotenv v1.4.0
8+
github.com/playwright-community/playwright-go v0.2000.1
9+
)
10+
11+
require (
12+
github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 // indirect
13+
github.com/go-stack/stack v1.8.1 // indirect
14+
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
15+
)

go.sum

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 h1:y5HC9v93H5EPKqaS1UYVg1uYah5Xf51mBfIoWehClUQ=
2+
github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964/go.mod h1:Xd9hchkHSWYkEqJwUGisez3G1QY8Ryz0sdWrLPMGjLk=
3+
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
4+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
5+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
6+
github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw=
7+
github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4=
8+
github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.1 h1:wG8n/XJQ07TmjbITcGiUaOtXxdrINDz1b0J1w0SzqDc=
9+
github.com/go-telegram-bot-api/telegram-bot-api/v5 v5.5.1/go.mod h1:A2S0CWkNylc2phvKXWBBdD3K0iGnDBGbzRpISP2zBl8=
10+
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
11+
github.com/h2non/filetype v1.1.1/go.mod h1:319b3zT68BvV+WRj7cwy856M2ehB3HqNOt6sy1HndBY=
12+
github.com/joho/godotenv v1.4.0 h1:3l4+N6zfMWnkbPEXKng2o2/MR5mSwTrBih4ZEkkz1lg=
13+
github.com/joho/godotenv v1.4.0/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
14+
github.com/playwright-community/playwright-go v0.2000.1 h1:2JViSHpJQ/UL/PO1Gg6gXV5IcXAAsoBJ3KG9L3wKXto=
15+
github.com/playwright-community/playwright-go v0.2000.1/go.mod h1:1y9cM9b9dVHnuRWzED1KLM7FtbwTJC8ibDjI6MNqewU=
16+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
17+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
18+
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
19+
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
20+
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
21+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
22+
gopkg.in/square/go-jose.v2 v2.6.0 h1:NGk74WTnPKBNUhNzQX7PYcTLUjoq7mzKk2OKbvwk2iI=
23+
gopkg.in/square/go-jose.v2 v2.6.0/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI=
24+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
25+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

0 commit comments

Comments
 (0)