This is a Telegram bot I'm working on in my free time to learn Rust.

Overview

Maldness Bot

This is a Telegram bot I'm working on in my free time to learn Rust.

Building

docker build -t . should be enough.

External dependencies

  • PostgreSQL

Configuration

Until 2021.1 (aka the first stable release), I change configuration options very frequently, so expect the provided config to be broken!

= supergroup = {-1234567 = true} group = {} channel = {} # 0 means "*" or every chat of the following type private = {0 = true} [open_weather] # OpenWeather API key api_key = "abcde" # OpenWeather units: could be standard (Kelvin), metric (Celsius) and imperial (Fahrenheit) units = "metric" # OpenWeather language: https://openweathermap.org/current#multi language = "en" # /weather message format, available variables: # * name - Geolocation name # * temp - Current temperature in the location # * feels_like - Current "feels like" in the location # * description - human-readable description with some emoji indicating current weather message_format = "{{ name }}: {{ temp }} (feels like {{ feels_like }}), {{ description }}" [commands.donate] # Text for the /donate command text = "https://patreon.com/defman" [commands.weather] # Text for when the bot could not find weather data for a location not_found_text = "No weather data for this location found" # Text for when the user does not have a location set but tries to call /weather without arguments no_location_text = "You don't have a location set. Send me a geolocation message and call /set_my_location on it." # Text for when someone tries to look up other's user location forecast, and they don't have a location set no_location_for_user_text = "This user does not have a location set." [commands.gn] # Text for the /gn command good_night_text = "Good night!" [commands.shuffle] # Text for when the bot could not shuffle anything in the message or in the reply to the message nothing_to_shuffle_text = "Nothing to shuffle!" ">
# telegram bot token
token = "1234567:ABCDEFG"
# List of user ids with admin privileges 
admins = [123, 456]
# PostgreSQL dsn string
postgres_dsn = "postgresql://admin:123@postgres/maldness_bot?sslmode=disable" 
# Wake-up message format, available variables:
# * username - telegram username
# * message - optional text message they've left when went to bed (N/A if none)
# * duration - human-readable duration (1h 2m 3s)
wake_up_format = "{{ username }} woke up and said: {{ message }}. He've slept for {{ duration }}"

[allowed_chats]
# allow unspecified chats to use the bot, defaults to true
allow_unspecified = false
# a map of  = 
supergroup = {-1234567 = true}
group = {}
channel = {}
# 0 means "*" or every chat of the following type
private = {0 = true}

[open_weather]
# OpenWeather API key
api_key = "abcde"
# OpenWeather units: could be standard (Kelvin), metric (Celsius) and imperial (Fahrenheit)
units = "metric"
# OpenWeather language: https://openweathermap.org/current#multi
language = "en"
# /weather message format, available variables:
# * name - Geolocation name
# * temp - Current temperature in the location
# * feels_like - Current "feels like" in the location
# * description - human-readable description with some emoji indicating current weather
message_format = "{{ name }}: {{ temp }} (feels like {{ feels_like }}), {{ description }}"

[commands.donate]
# Text for the /donate command
text = "https://patreon.com/defman"

[commands.weather]
# Text for when the bot could not find weather data for a location
not_found_text = "No weather data for this location found"
# Text for when the user does not have a location set but tries to call /weather without arguments
no_location_text = "You don't have a location set. Send me a geolocation message and call /set_my_location on it."
# Text for when someone tries to look up other's user location forecast, and they don't have a location set
no_location_for_user_text = "This user does not have a location set."

[commands.gn]
# Text for the /gn command
good_night_text = "Good night!"

[commands.shuffle]
# Text for when the bot could not shuffle anything in the message or in the reply to the message
nothing_to_shuffle_text = "Nothing to shuffle!"
You might also like...
Telegram bot that zhuzh Twitter content
Telegram bot that zhuzh Twitter content

@twt_2_tg_bot Telegram bot that zhuzh shared Twitter content Text converter Some tweets may contain line breaks or even dialogs. Such tweets are barel

Uradhura is a telegram bot that fetches information and media from reddit
Uradhura is a telegram bot that fetches information and media from reddit

Pathetic little Telegram bot that fetches information from Reddit posts(with gif, image(post with single image) and video)

A Telegram bot to watch animes

AmimeWatch A Telegram bot to watch animes. Re-written version of AmimeWatch in Rust. Preparing Configuration Create a file named config.toml and fill

An out-of-box ChatGPT bot for Telegram.
An out-of-box ChatGPT bot for Telegram.

TeleGPT API Docs | Releases | Twitter An out-of-box ChatGPT bot for Telegram. TeleGPT is a Telegram bot based on teloxide framework and async_openai.

An out-of-box ChatGPT bot for Telegram.
An out-of-box ChatGPT bot for Telegram.

TeleGPT API Docs | Releases | Twitter An out-of-box ChatGPT bot for Telegram. TeleGPT is a Telegram bot based on teloxide framework and async_openai.

A Telegram ChatGPT bot
A Telegram ChatGPT bot

A customizable Telegram bot with a ChatGPT (or GPT4, bring your own API key) backend. You can configure the bot’s context and prompt in template settings.

A simple telegram bot to get the tunnel info from ngrok.
A simple telegram bot to get the tunnel info from ngrok.

Telegram Ngrok Bot A simple bot to fetch the running tunnels from ngrok api. Prerequisits Ngrok agent should be running. Configuration Ngrok config ve

🦜 A hassle-free, highly performant, host it yourself Discord music bot built with Serenity in Rust. Powered by youtube-dl and Genius.

🦜 A hassle-free, highly performant and fast evolving Discord music bot built with Serenity in Rust. Deployment Usage Just create a bot account, copy

Matrix bot inspired by Shirt Bot.

matrix-openai-bot Matrix bot inspired by Shirt Bot. Usage Run the bot after building it or grabbing the latest release $ matrix-openai-bot Edit the ge

Comments
  • Allowed chat ids per chat type

    Allowed chat ids per chat type

    Currently, the bot only limits group chats to some allowed chat_id's. There should be a way to limit it for other chat types (“private”, “group”, “supergroup” or “channel” according to https://core.telegram.org/bots/api#chat)

    enhancement 
    opened by Defman21 0
  • Improve weather command

    Improve weather command

    • [x] 1. Allow to provide the format for the message in the config (ad5693c)
    • [x] 2. Add an emoji depending on the weather (sunny, cloudy, etc.) (0e2c6ed)
    • [x] 3. Round up the temperature to one number after . (12.3 instead of 12.34 as of now) (0e2c6ed)
    • [x] 4. Do not require /weather to be called on the geolocation messages (should be configurable) (9e2bc50)
    • [x] 5. Allow for a user to set their location and use it if the command is called without arguments (8358ed2)
    opened by Defman21 0
  • /gn command

    /gn command

    /gn <afk message>, /gn resume (starts a new sleeping session with the previous message).

    The session ends when the user sends an update.

    I should keep sessions somewhere, so I could display some funny stats later (this is something that might not get into the MVP, but still a good feature).

    enhancement 
    opened by Defman21 0
  • /info command

    /info command

    /info <username>

    Returns a message that looks like that:

    if stream.is_online { |...$stream|
        <image source=$>
        $name
        $game
    	$viewer_count
    } else {
    	<image source=$placeholders[is_offline]>
    }
    
    enhancement 
    opened by Defman21 0
Owner
Sergey Kislyakov
Sergey Kislyakov
Telegram bot to fetch images from Terceira Ponte and Rodosol into your Telegram chat.

rodosol-telegram-bot Add this bot to your contacts list This bot is a quick scraper that gets the pictures from the rodosol "De olho na via" feature a

Armando Magalhães 1 Jan 9, 2022
Learn-rust - An in-depth resource to learn Rust 🦀

Learning Rust ?? Hello friend! ?? Welcome to my "Learning Rust" repo, a home for my notes as I'm learning Rust. I'm structuring everything into lesson

Lazar Nikolov 7 Jan 28, 2022
A Simple, But amazing telegram bot, Made using the Rust language!

Telegram bot in Rust A fun Telegram bot made using Rust language.

Deep Alchemy 2 Dec 21, 2021
Rust telegram bot library for many runtimes

Telbot Telbot provides telegram bot types and api wrappers. Specifically, telbot now supports: telbot-types: basic telegram types / requests / respons

kiwiyou 17 Dec 3, 2022
Telegram bot for searching in Arch User Repository ( AUR ); Implemented using rust.

AurSearchBot A Telegram Inline Search Bot Written in Rust Introduction Telegram Bot that can search AUR ( Arch User Repository ) in inline mode. This

AlenPaulVarghese 3 Feb 15, 2022
Autogenerated wrapper for the Telegram Bot API written in Rust.

An Elegant Rust Client for Telegram Bot API crates.io • docs.rs Table of contents Introduction Key Features Installation Getting Started Documentation

FerrisGram 22 Oct 29, 2022
A simple Telegram bot that eats anonymous channel messages, written in Rust.

tgbot-nochanmsg By Asuna Right Control When creating your bot from botfather, it's not bad to disable privacy mode, because it needs to access the mes

h3a.moe 2 Aug 5, 2022
A Telegram bot written in Rust.

Knight-Bot Table of Contents About Support chat Installation Setting up your environment Build manually Commands Commands on TODO list Find this bot A

cyberknight777 25 Apr 27, 2023
This is a simple Telegram bot with interface to Firefly III to process and store simple transactions.

Firefly Telegram Bot Fireflies are free, so beautiful. (Les lucioles sont libres, donc belles.) ― Charles de Leusse, Les Contes de la nuit This is a s

null 13 Dec 14, 2022
Telegram Bot Template with Cloudflare Workers

cf-workers-telegram-bot-template Usage This template starts you off with a src/lib.rs file, acting as an entrypoint for requests hitting your Worker.

Lee Taehoon 2 Sep 23, 2021