Telegram Bot for everyday raffles

Overview

SpinEverydayBot v2

Codacy badge wakatime badge Crowdin badge Requirements badge Code style: black License badge

Telegram bot for everyday raffles. HIGHLY EXPERIMENTAL! WORK IN PROGRESS!

Setting up

Requirements

  • Python 3.9+
  • PostgreSQL 13+

Older versions might work, but not tested. If they do work, submit an issue.

Steps

  1. (Optional.) Create and set up new virtualenv for the project.
  2. Install requirements from requirements.txt by running pip install -Ur requirements.txt.
  3. Create config.yaml in current directory or in ~/.config/spin_everyday_bot/2.x/.
  4. Open your config.yaml and edit it to match your setup.
    telegram:
      token: ...
      superuser_id: ...
    db:
      host: 127.0.0.1
      port: 5432
      user: ...
      database: ...
      password: ...
  5. Migrate database by running alembic upgrade head

Running

Polling

It's as easy as python -m spin_everyday_bot

Webhooks

  1. Make sure you've got HTTPS certificate. Please note that self-signed ones are not yet supported, go and create one with Let's Encrypt. If you don't have a domain name, but you have static IP, use nip.io to create "fake" domain.
  2. Set up a reverse-proxy like nginx with above certificate and pointing to http://localhost:8880/.
  3. Install additional requirements: pip install -U "FastAPI~=0.68.0" uvicorn.
  4. Run python -m spin_everyday_bot webhook -u "<WEBHOOK_URL>", where <WEBHOOK_URL> is the URL for Telegram to make requests to.

Updating

Before you run a new version after updating, make sure your database is up-to-date by running migrations and check whether your config matches (see Setting up section for more info).

Contributing

Oh, you wanna contribute? That's nice!

  1. Make sure the project is set up and up-to-date.
  2. Install additional requirements from dev-requirements.txt.
  3. Make changes to the code.
  • If you made any changes to db, make sure you created a migration by running alembic revision --autogenerate -m '<description>' and verified it.
  • If you made any changes which require translation changes, make sure you generated a new translation template by running
    pybabel extract \
       --msgid-bugs-address="[email protected]" \
       --copyright-holder="Evgeniy Filimonov <[email protected]>" \
       --project=spin_everyday_bot --version=2.0.0-alpha.0 \
       -o spin_everyday_bot/lang/spin_everyday_bot.pot -w 99 \
       spin_everyday_bot
  1. Run some tools to make code style better
    isort --py 39 -p spin_everyday_bot --profile black -l 100 --tc --gitignore spin_everyday_bot
    black -l 100 -t py39 spin_everyday_bot
  2. Commit and push changes to your branch/fork.
  3. Create a pull request.

License

Licensed under GNU AGPL v3, see LICENSE.

You might also like...
Telegram bot implementing Lex Arcana using python-telegram-bot library.
Telegram bot implementing Lex Arcana using python-telegram-bot library.

Lex Arcana Telegram Bot 🤖 Telegram bot implementing Lex Arcana using python-telegram-bot library. This bot was evaluated for the course "Computer Eng

A Telegram Filter Bot, Support Unlimited Filter. Also, The Bot can auto-filter telegram File | video

A Telegram Filter Bot, Support Unlimited Filter. Also, The Bot can auto-filter telegram File | video

A Powerful telegram giveawayz bot based on the python-telegram-bot API
A Powerful telegram giveawayz bot based on the python-telegram-bot API

GiveawayZ Bot A Powerful telegram giveawayz bot based on the python-telegram-bot API. Powered by Team Zyntax and Team DFX Developed by @Zycho-Dev A pr

Asad Alexa VC Bot Is A Telegram Bot Project That's Allow You To Play Audio And Video Music On Telegram Voice Chat Group.
Asad Alexa VC Bot Is A Telegram Bot Project That's Allow You To Play Audio And Video Music On Telegram Voice Chat Group.

Asad Alexa VC Bot Is A Telegram Bot Project That's Allow You To Play Audio And Video Music On Telegram Voice Chat Group.

A telegram bot script for generating session string using pyrogram and telethon on Telegram bot

String-session-Bot Telegram Bot to generate Pyrogram and Telethon String Session. A star ⭐ from you means a lot to us! Usage Deploy to Heroku Tap on a

Video Bot: an Advanced Telegram Bot that's allow you to play Video & Music on Telegram Group Video Chat
Video Bot: an Advanced Telegram Bot that's allow you to play Video & Music on Telegram Group Video Chat

Video Bot is an Advanced Telegram Bot that's allow you to play Video & Music on

Web-music-bot - A telegram bot which get a *site Url* and sends all songs contain in the Url to telegram

web music bot this is a telegram bot which get a site Url and sends all songs co

Telegram bot for logistic - Telegram bot for logistic

Демонстрационный телеграм-бот для нужд транспортной компании Цель проекта Реализ

A simple Telegram bot that analyses a given word, built with python-telegram-bot
A simple Telegram bot that analyses a given word, built with python-telegram-bot

Telegram Word Bot A simple Telegram bot that analyses a given word, built with python-telegram-bot. The bot is fairly useless - unless you often need

Comments
  • v.2.0

    v.2.0

    Список дел:

    • [x] Добавить локализацию (#11)

      • [x] Английский
    • [x] Настройки "культурности" бота (см. п.1) (реализуется добавлением локализаций и настраиваемых текстов)

    • [x] Настраиваемые тексты розыгрышей (#15)

    • [ ] Предпочитаемая временная зона чата (для /auto)

    • [x] Кто может запускать розыгрыши (#18)

    • [x] Быстрый розыгрыш

    • [x] Победитель среди всех пользователей чатов (см. п.2)

    • [ ] Статистика в ЛС и в инлайне

    • [x] Время работы (аптайм)

    • [x] Список участвующих в розыгрыше

    • [ ] "Тихий режим" (меньше сообщений в чате)

    • [x] Разный /help в чат и ЛС

    • [ ] Использование @username'ов в /admgroup и /stat

    • [ ] Мультирозыгрыш (#5)

    • [ ] Перезапуск розыгрыша

    • [ ] Сохранение данных (бекапы)

    • [x] Лимит команд

    • [x] Рефакторинг


    Примечания

    1)

    Отлично, а тебе не помешает разрабатывать режим, матерный и обычный, если хочешь чтобы бот был масштабным)

    (c) @Alycus

    2)

    Проводить ещё один розыгрыш, но среди всех чатов, и выявлять победителя. А потом по команде /winner (допустим) показывать имя этого человека-победителя

    (c) @evgfilim1 совместно с @Yanuch1

    enhancement 
    opened by evgfilim1 1
  • Fix usernames with underscores in quiz name

    Fix usernames with underscores in quiz name

    This patch fixes usernames with underscores in quiz name.

    For example, before this patch, command of:

    /setname @user_name_example_with_underscores
    

    leads to output like:

    Согласно сегодняшнему розыгрышу, @user\_name\_example\_with\_underscores дня ...
    

    Now, it is fixed.

    opened by foxtran 0
  • [Feature request] Возможность создания алиасов для команды /spin

    [Feature request] Возможность создания алиасов для команды /spin

    Было бы неплохо, скажем разыгрываем мы пидора дня. Почему бы не делать это командой /pidor, а не /spin? Разумеется это всё должно настраиваться по-чатово.

    /spinalias add pidor
    /spinalias del pidor
    /spinalias list
    
    enhancement 
    opened by ghost 0
  • Усовершенствовать /settings в ЛС

    Усовершенствовать /settings в ЛС

    Можно проверять чаты на наличие в них человека, а там уже проверять есть ли у него права администратора. Затем составлять интерфейс с выбором, настройки какого чата хочет изменить пользователь. Отдалённо что-то похожее делает GitHub бот.

    by @HexwellC

    enhancement 
    opened by evgfilim1 0
Releases(v.1.5.4-beta)
  • v.1.5.4-beta(Aug 5, 2021)

    • Moved data and log to data/ subdirectory
    • Added settings (#14)
    • Added /uptime command
    • Added translation ability
    • Added "Winner of the day" via /winner command
    • Added custom spin texts for chats
    • Other fixes and minor improvements

    This branch is running on @spin_everyday_betabot

    Source code(tar.gz)
    Source code(zip)
  • v.1.5.3(May 29, 2017)

  • v.1.5.2(May 29, 2017)

    + Added '/feedback' command + Added some useful '/sudo' commands + New spin feature * Moved to python-telegram-bot 6.0.1 * Fixed bug with loading spin jobs * Now unexpected updates are not allowed * Cleaning updates when working via TeleSocket * Code fixes and other improvements

    Source code(tar.gz)
    Source code(zip)
  • v.1.5.1(Apr 15, 2017)

    + Now using webhooks (powered by TeleSocket Service) for bot, but you can still use LongPoll + Now help is sending by pages (#13) + Added install script * Changed logging levels * Fixed bug when bot creator can't change spin name in chat * Now ignoring KeyError when unknown user leaves chat * Code fixes

    Source code(tar.gz)
    Source code(zip)
  • v.1.5(Mar 30, 2017)

    + Automatic spins! + Added logging to telegram chat or channel and to file + Now deleted users are removed from user list * Fixed mention in one of textpacks * Fixed bug with stats and spin * Code fixes

    Source code(tar.gz)
    Source code(zip)
  • v.1.4(Mar 25, 2017)

    + Added new feature for bot creators ("/sudo help") + Now you can see who can change spin name + Now there are pages in "/stat" command * Fixed issue #12 * Textpacks changes: 2 new, 1 fixed, 1 removed

    Source code(tar.gz)
    Source code(zip)
  • v.1.3(Feb 1, 2017)

    + Added creator's command that resets spin result in the current chat + Added '/sudo md_announce' and '/sudo announce' + Added feature of listing top chat users + Added one more "textpack" + Added feature of giving rights to change spin name * Now showing spin name on empty '/setname' (a.k.a. '/setsn') * Fixed issue #7 * A bit updated 'TEXT_ALREADY' * Now if spin name in '/setname' ends on 'дня', this word will be deleted * Code fixes - Removed '-sn' suffix in commands - Removed feature of manual refreshing admin list

    Source code(tar.gz)
    Source code(zip)
  • v.1.2(Jan 25, 2017)

    + '/sudo reset' feature + Checking if user is in the chat + Choosing one of three spin "textpacks" * Using Python 3.6 with its formatting feature * README.md fixed * Some code improvements

    Source code(tar.gz)
    Source code(zip)
  • v.1.1.1(Jan 25, 2017)

    + Markdown escape (Issue #3) + Checking command destination (Issue #4) + Clean start * Fixed announcement * Some code fixes * Now /start and /help commands are sent in PM

    Source code(tar.gz)
    Source code(zip)
  • v.1.1(Jan 25, 2017)

    + Added announcement to all chats + Added documentation * Bot is now splitted into different files * Fixed bug with /setsn (issue #1) * /admin was renamed to /sudo

    Source code(tar.gz)
    Source code(zip)
  • v.1.0(Mar 30, 2017)

Owner
evgfilim1
Student, @aiogram contributor, freelancer, cat
evgfilim1
This wrapper now has async support, its basically the same except it uses asyncio

This is a python wrapper for my api api_url = "https://api.dhravya.me/" This wrapper now has async support, its basically the same except it uses asyn

Dhravya Shah 5 Mar 10, 2022
⚡ A really fast and powerful Discord Token Checker

discord-token-checker ⚡ A really fast and powerful Discord Token Checker How To Use? Do pip install -r requirements.txt in your command prompt Make to

vida 25 Feb 26, 2022
A Python wrapper for Discord RPC API

Discord RPC An Python wrapper for Discord RPC API. Allow you to make own custom RPC Install PyPI pip install discord-rpc Quick example import Discord

LyQuid :3 10 Dec 29, 2022
Discord feeder for AIL

ail-feeder-discord Discord feeder for AIL Warning! Automating user accounts is technically against TOS, so use at your own risk! Discord API https://d

ail project 6 Mar 09, 2022
Python library for generating sequences with uniform stimulus history

Sampling Euler tours for uniform stimulus history Table of Contents About Examples Experiment 1 Experiment 2 Experiment 3 Experiment 4 Experiment 5 Co

5 Nov 11, 2021
An Advance Discord Generator Written in python Verified Email and Phone Number For Free!

Intro An Advance Discord Generator Written in python It can generate nearly fully verified tokens USAGE put server invite code inside ( invitecode = "

36 May 02, 2022
Python Wrapper for aztro - The Astrology API | Get Daily Horoscope 💫

PyAztro PyAztro is a client library for aztro written in Python. aztro provides horoscope info for sun signs such as Lucky Number, Lucky Color, Mood,

Sameer Kumar 30 Jan 08, 2023
Generates a coverage badge using coverage.py and the shields.io service.

Welcome to README Coverage Badger 👋 Generates a coverage badge using coverage.py and the shields.io service. Your README file is then updated with th

Victor Miti 10 Dec 06, 2022
Prime Mega is a modular bot running on python3 with autobots theme and have a lot features.

PRIME MEGA Prime Mega is a modular bot running on python3 with autobots theme and have a lot features. Easiest Way To Deploy On Heroku This Bot is Cre

『TØNIC』 乂 ₭ILLΣR 45 Dec 15, 2022
EzilaX Music ❤ is the best and only Telegram VC player with playlists, Multi Playback, Channel play and more POWERD By SDBOTs

EzilaX-Music 🎵 A bot that can play music on Telegram Group and Channel Voice Chats Available on telegram as @EzilaXMBot Features 🔥 Thumbnail Support

Sadew Jayasekara 9 Oct 24, 2021
Twitter feed of newly published articles in Limnology

limnopapers Code to monitor limnology RSS feeds and tweet new articles. Scope The keywords and journal choices herein aim to focus on limnology (the s

7 Dec 20, 2022
A Python script for rendering glTF files with V-Ray App SDK

V-Ray glTF viewer Overview The V-Ray glTF viewer is a set of Python scripts for the V-Ray App SDK that allow the parsing and rendering of glTF (.gltf

Chaos 24 Dec 05, 2022
Python 3 SDK/Wrapper for Huobi Crypto Exchange Api

This packages intents to be an idiomatic PythonApi wrapper for https://www.huobi.com/ Huobi Api Doc: https://huobiapi.github.io/docs Showcase TODO Con

3 Jul 28, 2022
🚀🔥使用Python连接阿里云盘, 实现了官方大部分功能 👍👍

aligo 🚀 🔥 使用Python连接阿里云盘, 实现了官方大部分功能 👍 👍 为了完善代码提示, 方便大家代码书写, aligo 引入了一些 python 3.8 的新特性, 所以要求 python = 3.8.* pip install aligo 或 pip install ali

455 Jan 08, 2023
A Matrix-Instagram DM puppeting bridge

mautrix-instagram A Matrix-Instagram DM puppeting bridge. Documentation All setup and usage instructions are located on docs.mau.fi. Some quick links:

89 Dec 14, 2022
Framework for Telegram users and chats investigating.

telegram_scan Fantastic and full featured framework for Telegram users and chats investigating. Prerequisites: pip3 install pyrogram; get api_id and a

71 Dec 17, 2022
Auto like & auto followers facebook

Auto like & auto followers facebook

Fahmi Dev 23 Dec 08, 2022
Automatically changes your discord status

Automatically changes your discord status, Be careful as this may get you rate limited and banned

octo 5 Sep 20, 2022
A Telegram Bot to generate permanent Stream and Download links for any Telegram file

Telegram File To Stream Link This bot will give you permanent Stream and Download links for Telegram files Deploy the Bot Press the below button to de

Shadow 80 Dec 16, 2022
🧑‍💼 Python wrapper for the Seek API

seek-com-au-api 🧑‍💼 Python wrapper for the seek.com.au API (unofficial) Installation Using Python = 3.6: pip install -e git+https://github.com/tomq

Tom Quirk 1 Oct 24, 2021