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
Scuttlecrab.py - Python Version of Scuttle Crab Bot

____ _ _ _ ____ _ / ___| ___ _ _| |_|

Fabrizo 4 Jul 08, 2022
Pincer-ext-commands - A simple, lightweight package for pincer prefixed commands

pincer.ext.commands A reimagining of pincer's command system and bot system. Ins

Vincent 2 Jan 11, 2022
Retrieves GitHub Stats via `git_api` and flask.

GitHub User Search Created using Python3 and git_api, coded by JBYT27. About This is a project I decided to make for Kajam, but I decided to choose a

an aspirin 4 May 11, 2022
A free and open-source discord webhook spammer.

Discord-Webhook-Spammer A free and open-source discord webhook spammer. Usage Depending on your python installation your commands may vary. Below are

3 Sep 08, 2021
Retrieve information from DBLP and update BibTex files automatically

Rebib TLDR: This script retrieves information from DBLP to update your BibTex files. python rebib.py --bibfile xxx.bib It first parses the bib entries

Shangtong Zhang 49 Jan 01, 2023
A Telelgram Bot to Extract Text from an Image

Text-Scanner-OCR A Telelgram Bot to Extract Text from an Image Configs Vars API_KEY: Your API_KEY from OCR Space GROUP: Your Group Username without '@

ALBY 8 Feb 20, 2022
unofficial library for discord components(on development)

discord.py-buttons unofficial library for discord buttons(on development) Install pip install --upgrade discord_buttons Example from discord import Cl

kiki7000 129 Dec 31, 2022
Throttle and debounce add-on for Pyrogram

pyrothrottle Throttle and debounce add-on for Pyrogram Quickstart implementation on decorators from pyrogram import Client, filters from pyrogram.type

7 Oct 01, 2022
Update your World of Warcraft AddOns hosted on GitHub

AddOns Update Tool Tool to update World of Warcraft AddOns hosted on GitHub Features Pure Python: only Dulwich and Colorlog Multithreaded tasks Manual

Mr. Alchemist 16 Dec 06, 2022
Primeira etapa do processo seletivo para a bolsa de migração de conteúdo de Design de Software.

- Este processo já foi concluído. Obrigado pelo seu interesse! Processo Seletivo para a bolsa de migração de conteúdo de Design de Software Primeirame

Toshi Kurauchi 1 Feb 21, 2022
Video-Player - Telegram Music/ Video Streaming Bot Using Pytgcalls

Video Player 🔥 ᴢᴀɪᴅ ᴠᴄ ᴘʟᴀyᴇʀ ɪꜱ ᴀ ᴛᴇʟᴇɢʀᴀᴍ ᴘʀᴏᴊᴇᴄᴛ ʙᴀꜱᴇᴅ ᴏɴ ᴘʏʀᴏɢʀᴀᴍ ꜰᴏʀ ᴘʟᴀʏ

Zaid 16 Nov 30, 2022
Python client for Invidious' JSON API

Python project template A template for new Python projects. Features Automatically builds PDoc documentation & uploads package to PyPI on new GitHub r

Kevo 2 Jun 05, 2022
Get charts, top artists and top songs WITHOUT LastFM API

LastFM Get charts, top artists and top songs WITHOUT LastFM API Usage Get stats (charts) We provide many filters and options to customize. Geo filter

4 Feb 11, 2022
Deleting someone else's Instagram account, repeat until the target account is blocked.

Program Features 📌 Instagram report V4. 📌 Coded with the latest version of Python. 📌 Has automatic scheduling. 📌 Full account report. 📌 Report a

hack4lx 16 Oct 25, 2022
An Open-Source Discord bot created to provide basic functionality which should be in every discord guild. We use this same bot with additional configurations for our guilds.

A Discord bot completely written to be taken from the source and built according to your own custom needs. This bot supports some core features and is

Tesseract Coding 14 Jan 11, 2022
Complete portable pipeline for masking of Aadhaar Number adhering to Govt. Privacy Guidelines.

Aadhaar Number Masking Pipeline Implementation of a complete pipeline that masks the Aadhaar Number in given images to adhere to Govt. of India's Priv

1 Nov 06, 2021
Predict the Site EUI, given the characteristics of the building and the weather data for the location of the building.

wids_datathon_2022 Description: Contains a data pipeline used to predict energy EUI Goals: Dataset exploration Automating the parameter fitting, gener

1 Mar 25, 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
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
👨‍💼Linkedin API for Python

linkedin_api 👨‍💼 Linkedin API for Python No "official" API access required - just use a valid Linkedin account! Programmatically send messages, get

Tom Quirk 918 Dec 29, 2022