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
null 1 Feb 18, 2022
Telegram bot to stream videos in telegram voicechat for both groups and channels. Supports live strams, YouTube videos and telegram media.

Telegram VCVideoPlayBot An Telegram Bot By @ZauteKm To Stream Videos in Telegram Voice Chat. NOTE: Make sure you have started a VoiceChat in your Grou

Zaute 20 Oct 21, 2022
Telegram bot to stream videos in telegram voicechat for both groups and channels. Supports live strams, YouTube videos and telegram media.

Telegram bot to stream videos in telegram voicechat for both groups and channels. Supports live strams, YouTube videos and telegram media.

SUBIN 449 Dec 27, 2022
This is telegram bot to generate string session for using user bots. You can see live bot in https://telegram.dog/string_session_Nsbot

TG String Session Generate Pyrogram String Session Using this bot. Demo Bot: Configs: API_HASH Get from Here. API_ID Get from Here. BOT_TOKEN Telegram

Anonymous 27 Oct 28, 2022
A telegram bot which can show you the status of telegram bot

BotStatus-Ts-Bot An open source telegram Bot Status bot For demo you can check here The status is updated in every 1 hour About Bot This is a Bot stat

Ts_Bots 8 Nov 17, 2022
Telegram PHub Bot using ARQ Api and Pyrogram. This Bot can Download and Send PHub HQ videos in Telegram using ARQ API.

Tg_PHub_Bot Telegram PHub Bot using ARQ Api and Pyrogram. This Bot can Download and Send PHub HQ videos in Telegram using ARQ API. OS Support All linu

TheProgrammerCat 13 Oct 21, 2022
veez music bot is a telegram music bot project, allow you to play music on voice chat group telegram.

?? Veez Music Bot Music bot for playing music on telegram voice chat group. Requirements ?? FFmpeg NodeJS nodesource.com Python 3.7+ PyTgCalls ?? Get

levina 143 Jun 19, 2022
A simple telegram voting bot based on the python-telegram-bot api.

A simple telegram voting bot based on the python-telegram-bot api. *To make it more easy to use, I might make a C++ code in the future so you don't ha

null 3 Sep 13, 2021
An Telegram Bot By @AsmSafone To Stream Videos in Telegram Voice Chat. This is Also The Source Code of The Bot Which is Being Used In @SafoTheBot Group! ❤️

Telegram Video Player Bot (Beta) An Telegram Bot By @AsmSafone To Stream Videos in Telegram Voice Chat. Special Features Supports Live Streaming From

SAF ONE 206 Jan 3, 2023