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
Upload comma-delimited files to biglocalnews.org in your GitHub Action

Upload comma-delimited files to biglocalnews.org in your GitHub Action Inputs api-key: Your biglocalnews.org API token. project-id: The identifier of

biglocalnews 1 Apr 20, 2022
A Bot to Track Kernel Upstreams from kernel.org and Post it on Telegram Channel

Channel Kernel Tracker is the channel where the bot will be sending the updates in. Introduction This is a Telegram Bot to Track Kernel Upstreams kern

Kartikeya Hegde 3 Oct 05, 2021
A tool to customize your discord tokens

Fastest Discord Token Manager - Features: Change Token Username Change Token Password Change Token Avatar Change Token Bio This tool is created by Ace

trey 15 Dec 27, 2022
An asyncio Python wrapper around the Discord API, forked off of Rapptz's Discord.py.

Novus A modern, easy to use, feature-rich, and async ready API wrapper for Discord written in Python. A full fork of Rapptz's Discord.py library, with

Voxel Fox 60 Jan 03, 2023
Man-Userbot adalah userbot Telegram modular yang berjalan di Python3 dengan database sqlalchemy

Man-Userbot Telegram Man-Userbot adalah userbot Telegram modular yang berjalan di Python3 dengan database sqlalchemy. Berbasis Paperplane dan ProjectB

DzLyz 1 Feb 12, 2022
A telegram bot providing recon and research functions for bug bounty research

Bug Bounty Bot A telegram bot with commands to simplify bug bounty tasks Installation Use Road Map Installation BugBountyBot is open-source so you can

Tyler Butler 1 Oct 23, 2021
A discord bot can stress ip addresses with python tool

Python-ddos-bot Coded by Lamp#1442 A discord bot can stress ip addresses with python tool. Warning! DOS or DDOS is illegal, i shared for educational p

IrgyGANS 1 Nov 16, 2021
GTPS Status Bot

Python GTPS Status Bot (BETA) Python GTPS Status Bot Require Python How To Use Download This Source Extract The Zip File Install the requirements (Mod

Lamp 4 Oct 11, 2021
A python bot that will allow you to have maximum luck during Veve drops.

VeveBot You can follow me here Github | Twitter Features: - Click on the purchase at the time of the drop. - Be able to choose to do more than one tes

Rodz 1 Dec 04, 2021
Discord bot written in python

Discord bot created by dpshark#3004 for fun List of features/commands: [keyword] responses tools !add [respons] Adds new response to [keyword] !remove

Daniel K.Gunleiksrud 3 Dec 28, 2021
Weather Tracker, made with Python using Open Weather API

Weather Tracker Weather Tracker, made with Python using Open Weather API

Sahil Kumar 1 Feb 07, 2022
Fetch information about a public Google document.

xeuledoc Fetch information about any public Google document. It's working on : Google Docs Google Spreadsheets Google Slides Google Drawning Google My

Malfrats Industries 655 Jan 03, 2023
Ross Virtual Assistant is a programme which can play Music, search Wikipedia, open Websites and much more.

Ross-Virtual-Assistant Ross Virtual Assistant is a programme which can play Music, search Wikipedia, open Websites and much more. Installation Downloa

Jehan Patel 4 Nov 08, 2021
gBasic - The easy multiplatform bot

gBasic The easy multiplatform bot gBasic is the module at the core of @GianpiertoldaBot, maintained with 3 for the entire community by the Stockdroid

Stockdroid Fans 5 Nov 03, 2021
Fetch Flipkart product details including name, price, MRP and Stock details in general as well as specific to a pincode

Fetch Flipkart product details including name, price, MRP and Stock details in general as well as specific to a pincode

Vishal Das 6 Jul 11, 2022
→ Comando Básico para Python Discord

Discord.py · Código @client.event async def on_ready(): print('He iniciado sessión en: {0.user}'.format(client)) @client.event async def on_messa

Panda.xyz 4 Mar 12, 2022
A mass account list editor for python

Account-List-Editor This is an mass account list editor Usage Run the editor.py file with python (python3 ./editor.py) Press a button (1/2) and drag &

ExtremeDev 1 Dec 20, 2021
WakeNote is a tool that hides notifications from you until you confirm you want to read them, with technology to help prevent the reading of depressing messages first thing in the morning.

By: Seanpm2001, Et; Al. Top README.md Read this article in a different language Sorted by: A-Z Sorting options unavailable ( af Afrikaans Afrikaans |

Sean P. Myrick V19.1.7.2 3 Oct 21, 2022
Declarative assertions for AWS

AWSsert AWSsert is a Python library providing declarative assertions about AWS resources to your tests. Installation Use the package manager pip to in

19 Jan 04, 2022
POC de uma AWS lambda que executa a consulta de preços de criptomoedas, e é implantada na AWS usando Github actions.

Cryptocurrency Prices Overview Instalação Repositório Configuração CI/CD Roadmap Testes Overview A ideia deste projeto é aplicar o conteúdo estudado s

Gustavo Santos 3 Aug 31, 2022