generated from AshokShau/go-telegram-bot
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f984cfc
Showing
13 changed files
with
572 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* @AshokShau |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
# Telegram Bot API Documentation Assistant | ||
|
||
This Telegram bot provides quick access to the Telegram Bot API documentation. Users can search for API methods and types using inline queries, and the bot will return detailed information about the specified API elements. | ||
|
||
### Demo Bot: [@BotApiDocsBot](https://t.me/BotApiDocsBot) | ||
|
||
## Features | ||
- Inline search for API methods and types. | ||
- Detailed descriptions, return types, and required fields for each method and type. | ||
- Easy access to the official documentation. | ||
|
||
## Prerequisites | ||
- Go version 1.23 or higher. | ||
- A Telegram bot token obtainable from [BotFather](https://core.telegram.org/bots#botfather). | ||
|
||
## Installation | ||
|
||
### 1. Install Go | ||
Follow the instructions to install Go on your system: [Go Installation Guide](https://golang.org/doc/install). | ||
|
||
<details> | ||
<summary>Easy Way:</summary> | ||
|
||
```shell | ||
git clone https://github.com/udhos/update-golang dlgo && cd dlgo && sudo ./update-golang.sh && source /etc/profile.d/golang_path.sh | ||
``` | ||
|
||
Exit the terminal and open it again to check the installation. | ||
</details> | ||
|
||
Verify the installation by running: | ||
|
||
```shell | ||
go version | ||
``` | ||
|
||
### 2. Clone the repository | ||
|
||
```shell | ||
git clone https://github.com/AshokShau/BotApiDocs&& cd BotApiDocs | ||
``` | ||
|
||
### 3. Set up the environment | ||
|
||
Copy the sample environment file and edit it as needed: | ||
|
||
```shell | ||
cp sample.env .env | ||
vi .env | ||
``` | ||
|
||
### 4. Build the project | ||
|
||
```shell | ||
go build | ||
``` | ||
|
||
### 5. Run the project | ||
|
||
```shell | ||
./BotApiDocs | ||
``` | ||
|
||
## Usage | ||
|
||
1. **Start a chat** with your bot on Telegram. Once the bot is running, you can search for API methods and types. | ||
2. Use the inline query feature by typing `@YourBotUsername <your_query>` to search for methods or types. | ||
3. The bot will return relevant results with detailed descriptions. | ||
|
||
## Contributing | ||
<details> | ||
<summary>Contribution Guidelines</summary> | ||
|
||
Contributions are welcome! Here's how you can help: | ||
|
||
1. **Fork the repository**. | ||
2. **Clone your forked repository** to your local machine. | ||
```shell | ||
git clone https://github.com/your-username/BotApiDocs.git | ||
cd BotApiDocs | ||
``` | ||
3. **Create a new branch** for your changes. | ||
```shell | ||
git checkout -b feature-branch | ||
``` | ||
4. **Make your changes** and commit them with a descriptive message. | ||
```shell | ||
git add . | ||
git commit -m "Description of your changes" | ||
``` | ||
5. **Push to your branch** and submit a pull request. | ||
|
||
Please ensure your code follows the project's coding standards and includes appropriate tests. | ||
</details> | ||
## License | ||
This project is licensed under the MIT License—see the [LICENSE](/LICENSE) file for details. | ||
## Contact | ||
[](https://t.me/FallenProjects) | ||
[](https://t.me/AshokShau) | ||
## Thanks | ||
- [Ashok Shau](https://github.com/AshokShau) for the project. | ||
- [PaulSonOfLars](https://github.com/PaulSonOfLars) for the [GoTgBot](https://github.com/PaulSonOfLars/gotgbot) library and [Api](https://github.com/PaulSonOfLars/telegram-bot-api-spec/raw/main/api.json). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: build | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.23.0' | ||
|
||
- name: Build | ||
run: go build -v ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.idea | ||
.env | ||
*.exe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 AshokShau | ||
|
||
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: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package config | ||
|
||
import ( | ||
"os" | ||
"strconv" | ||
|
||
_ "github.com/joho/godotenv/autoload" | ||
) | ||
|
||
var ( | ||
Token string | ||
OwnerId int64 | ||
WebhookUrl string | ||
Port string | ||
) | ||
|
||
func init() { | ||
Token = os.Getenv("TOKEN") | ||
OwnerId = toInt64(os.Getenv("OWNER_ID")) | ||
WebhookUrl = os.Getenv("WEBHOOK_URL") | ||
Port = os.Getenv("PORT") | ||
} | ||
|
||
func toInt64(str string) int64 { | ||
val, _ := strconv.ParseInt(str, 10, 64) | ||
return val | ||
} |
Oops, something went wrong.