Skip to content

Repository files navigation

高考倒计时Bot (Go版本)

Actions Releases Stars Software License

Chat on Telegram Chat on Telegram

Introduction

高考倒计时 @gaokao_bot 是一个 Telegram Bot,可以实现通过发送 Message、Inline Query 方式获取当前时间的高考倒计时。

本项目使用 Go 语言实现,基于 Java 原项目的完整功能复刻。

Features

  • 倒计时查询 - 发送命令或 Inline Query 获取高考倒计时
  • 定时推送 - 自动推送倒计时到指定群组
  • Guest 模式 - 在 Bot 非成员的群聊/私聊中被 @提及或回复时应答默认倒计时
  • Mini App - 可视化管理倒计时模板
  • 多环境支持 - 开发、测试、生产环境配置分离

Guest 模式

开启后,用户在任意聊天中 @提及 Bot(可附带年份参数,如 @gaokao_bot 2026)或回复 Bot 的消息即可获取默认模板倒计时,无需将 Bot 加入该聊天。

Guest 模式需在 BotFather 的 Mini App(/mybots → 选择 Bot → Bot Settings)中开启 Guest Mode 开关后生效,代码侧无需额外配置。

Quick Start

Requirements

  • Go 1.21+
  • MySQL 8.0+

Installation

# Clone repository
git clone https://github.com/HerbertGao/gaokao_bot.git
cd gaokao_bot

# Install dependencies
go mod download

# Configure environment
cp .env.example .env
# Edit .env with your configuration

# Initialize database
mysql -u root -p < sql/init.sql

# Run
go run cmd/gaokao_bot/main.go -env=dev

Build

./scripts/build.sh
./bin/gaokao_bot -env=prod

Tech Stack

  • Go 1.21+
  • telego - Telegram Bot SDK
  • GORM - ORM
  • MySQL 8.0+

Thanks to

License

The MIT License (MIT). Please see License File for more information.

About

TelegramBot @gaokao_bot

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages