Crates.io | event-bot |
lib.rs | event-bot |
version | 0.1.0 |
source | src |
created_at | 2018-05-20 08:28:03.395277 |
updated_at | 2018-05-20 08:28:03.395277 |
description | A bot for Telegram to manage time-based events |
homepage | |
repository | https://github.com/asonix/telegram-event-bot |
max_upload_size | |
id | 66299 |
size | 2,139,342 |
This bot exists to manage social events happening for connected chats on Telegram
You can talk to this bot on Telegram to get it added to your chats. The bot can be found at t.me/coconuts_event_bot.
/init
command. This will tell the bot that you want it to keep track of your channel./id
command in the chat./link id
where id
is the chat Id you got from the previous step. This tells the bot that users in your chat are allowed to create events for this channel.Things to note: This bot only works in supergroups, not regular groups. Please upgrade your group to a supergroup before using this bot.
/new
command. The bot will ask you which channel associated with your chats you'd like to create an event for.For admins:
/init - Initialize an event channel
/link - link a group chat with an event channel (usage: /link [chat_id])
/id - get the id of a group chat
For users:
In group chats:
/events - get a list of events for the current chat
/pinevents - pin a list of upcomming events in the current group
In private chats:
/new - Create a new event
/edit - Edit an event you're hosting
/delete - Delete an event you're hosting
/help - Print the help message
If you want to help develop this bot, you'll need to know how it works. This bot is backed by a Postgres database, and uses the tokio-postgres
crate for database interaction, but it uses the diesel_cli
application to manage migrations. You'll need to cargo install diesel_cli
and then run the migrations through diesel to get a dev environment set up.
This bot uses dotenv to help manage environment variables. A sample .env
file has been provied as .env.sample
. Copy this file to .env
and then set variables that make sense for your setup. This means you'll need to have a postgres database with an events table.
# .env.sample
# The following variables are used by telegram-event-bot
DB_HOST="localhost"
DB_PORT="5432"
DB_USER="events"
DB_PASS="events"
DB_NAME="events"
TEST_DB_NAME="events_test"
EVENT_URL="localhost:8000"
TELEGRAM_BOT_TOKEN="your bot token"
# This variable is used by diesel_cli
DATABASE_URL="postgres://events:events@localhost:5432/events"
The application is sectioned into three parts, the model in src/model
, the actors in src/actors
, and the main.rs
file. The model defines functions that execute database queries, the actors manage application state and hold the application logic, and the main file starts the actors with the required arguments.
There are currently 5 actors comprising this application.
The model has 6 modules that are useful
Additionally, there is a crate within this repository dedicated to handling the Web UI. That crate creates a series of actors to serve web requests, and communicates back to the EventActor with user-provided information.
Feel free to open issues for anything you find an issue with. Please note that any contributed code will be licensed under the GPLv3.
Copyright © 2018 Riley Trautman
Telegram Event Bot is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Telegram Event Bot is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. This file is part of Telegram Event Bot.
You should have received a copy of the GNU General Public License along with Telegram Event Bot. If not, see http://www.gnu.org/licenses/.