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
Backlog API v2 Client Library for Python

BacklogPy - Backlog API v2 Client Library for Python BacklogPy is Backlog API v2 Client Library for Python 2/3 Install You can install the client libr

Koudai Aono 7 Dec 16, 2022
A bot i made for a dead com server lol it gets updated daily etc

6ix-Bot-Source A bot i made for a dead com server lol it gets updated daily etc For The UserAgent CMD https://developers.whatismybrowser.com/ thats a

Swiper 9 Mar 10, 2022
A multi-tenant multi-client scalable product categorising demo stack

Better Categories 4All: A multi-tenant multi-client product categorising stack The steps to reproduce training and inference are in the end of this fi

7 Feb 15, 2022
Discord bot to administer IITD Study Servers (unofficial)

IITD-Bot Discord bot to administer IITD'20 Acad Server Commands hello to check if bot is online ?help to display this message ?set kerberos to set y

Aditya Singh 47 Dec 19, 2022
A Simple Telegram Bot That Can Generate Strong Password With Many Features Written In Python Using Pyrogram

Password-Generator-Bot A Simple Telegram Bot That Can Generate Strong Password With Many Features Written In Python Using Pyrogram Features Random Pas

Muhammed Fazin 17 Dec 23, 2022
Most Simple & Powefull web3 Trade Bot (WINDOWS LINUX) Suport BSC ETH

Most Simple & Powefull Trade Bot (WINDOWS LINUX) What Are Some Pros And Cons Of Owning A Sniper Bot? While having a sniper bot is typically an advanta

GUI BOT 4 Jan 25, 2022
A template / demo bot for the Halcyon matrix bot library

Halcyon stock bot Hello! This is an example / template bot using the halcyon matrix bot library. Feel free to ask questions in the matrix chat #halcyo

Wes Ring 1 Feb 04, 2022
Rocks vc Userbot: A Telegram Bot Project That's Allow You To Play Audio And Video Music On Telegram Voice Chat Group

⭐️ Rocks VC Userbot ⭐️ Telegram Userbot To Play Audio And Video Song On VC Chat

Dr Asad Ali 10 Jul 18, 2022
Python Discord Server Nuker

Untitled Nuker Python Discord Server Nuker Features: Ban Everyone Kick Everyone Rename Everyone Spam To All Channels Delete All Channels Delete All Ro

22 Dec 22, 2022
Check your bot status automatically using userbot, simply and easy

Status Checker Userbot check your bot status automatically using userbot, simply and easy. Mandatory Vars API_ID : Telegram API_ID, get it from my.tel

ALBY 6 Feb 20, 2022
OKEX数字货币自动交易python语言SDK

okex-py OKEx数字货币自动交易python语言SDK (非官方) OKEx Cryptocurrency Exchange python SDK (Unofficial) 本项目基于V5 API 使用例子 Example import okex.v5.account_api as acco

43 Dec 01, 2022
Send Informative, Concise Slack Notifications With Minimal Effort

slack-templates Send Informative, Concise Slack Notifications With Minimal Effort slack-templates Slack Integration Available Templates Usage Report t

9 Nov 03, 2022
Python wrapper for Wikipedia

Wikipedia API Wikipedia-API is easy to use Python wrapper for Wikipedias' API. It supports extracting texts, sections, links, categories, translations

Martin Majlis 369 Dec 30, 2022
Currency Merger is a simple tool for joining values in different currencies

Currency Merger Description Currency Merger is a simple tool for joining values in different currencies. For example, if I have money in USD, EUR, BRL

Arthur Diniz 1 Feb 08, 2022
Instrument asyncio Python for distributed tracing with AWS X-Ray.

xraysink (aka xray-asyncio) Extra AWS X-Ray instrumentation to use distributed tracing with asyncio Python libraries that are not (yet) supported by t

Gary Donovan 12 Nov 10, 2022
A project that automatically sends you a Medium article on a topic of your choosing to your email address daily.

Daily Article from Medium ✏️ About A project that automatically sends you a Medium article on a topic of your choosing to your email address daily. No

Orhan Emre Dikicigil 2 Apr 27, 2022
Cedric Owens 16 Sep 27, 2022
Is the CoWin website updated for registration?

CoWin-Update Is the CoWin website updated for registration? This is a very hacky PYTHON3 script to lookup the CoWin portal if they re-deployed their J

Yash Jakhotiya 5 May 10, 2021
ZELDA USERBOT adalah userbot Telegram modular yang berjalan di Python3 dengan database sqlalchemy.

ZELDA USERBOT TELEGRAM Userbot Yang Di Buat Karena Sering Gabut Di Telegram. ZELDA USERBOT adalah userbot Telegram modular yang berjalan di Python3 de

1 Dec 23, 2021
A comand-line utility for taking automated screenshots of websites

shot-scraper A comand-line utility for taking automated screenshots of websites For background on this project see shot-scraper: automated screenshots

Simon Willison 837 Jan 07, 2023