Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f6093ec01e | ||
|
|
99d84a5d35 | ||
|
|
02d4965efa | ||
|
|
e41338b5f6 | ||
|
|
47e371f270 | ||
|
|
5746e99b3f | ||
|
|
e1c14f7512 | ||
|
|
503dfb4215 | ||
|
|
a37c2ee1d7 | ||
|
|
449df672b5 | ||
|
|
d3b8c4f821 | ||
|
|
acbd0e5ad1 |
8
.github/workflows/publish.yaml
vendored
8
.github/workflows/publish.yaml
vendored
@@ -22,10 +22,10 @@ jobs:
|
|||||||
- name: Update setup.cfg
|
- name: Update setup.cfg
|
||||||
run: |
|
run: |
|
||||||
sed -i "
|
sed -i "
|
||||||
s/{project_name}/${{ github.event.repository.name }}/g;
|
s|{project_name}|${{ github.event.repository.name }}|g;
|
||||||
s/{project_version}/${{ github.ref_name }}/g;
|
s|{project_version}|${{ github.ref_name }}|g;
|
||||||
s/{author}/${{ github.repository_owner }}/g;
|
s|{author}|${{ github.repository_owner }}|g;
|
||||||
s/{description}/${{ github.event.repository.description }}/g
|
s|{description}|${{ github.event.repository.description }}|g
|
||||||
" setup.cfg
|
" setup.cfg
|
||||||
|
|
||||||
- name: Build package
|
- name: Build package
|
||||||
|
|||||||
22
README.rst
22
README.rst
@@ -3,7 +3,9 @@ FlanaBot
|
|||||||
|
|
||||||
|license| |project_version| |python_version|
|
|license| |project_version| |python_version|
|
||||||
|
|
||||||
Flanagan's bot.
|
Bot based on `github.com/AlberLC/multibot`_ to manage Discord, Telegram and Twitch chats, moderate them and add functionalities.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
------------
|
------------
|
||||||
@@ -14,6 +16,22 @@ Python 3.10 or higher is required.
|
|||||||
|
|
||||||
pip install flanabot
|
pip install flanabot
|
||||||
|
|
||||||
|
|
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
|
||||||
|
- Talks to users.
|
||||||
|
- Delete message batches.
|
||||||
|
- It works both in groups and in private chats.
|
||||||
|
- Understands numbers and amounts of time textually expressed (useful for deleting a message batch or saying "flanabot ban john for one hour and 20 minutes").
|
||||||
|
- Shows interactive via buttons charts of past, current and forecast weather.
|
||||||
|
- Change user roles temporarily or forever.
|
||||||
|
- Mute users temporarily or forever.
|
||||||
|
- Ban users temporarily or forever.
|
||||||
|
- Configurable default behavior for each chat, just talk to him to configure it.
|
||||||
|
- Get media from twitter, instagram and tiktok and send it to the chat. From tiktok also obtains data about the song that is playing in the video.
|
||||||
|
|
||||||
|
|
||||||
.. |license| image:: https://img.shields.io/github/license/AlberLC/flanabot?style=flat
|
.. |license| image:: https://img.shields.io/github/license/AlberLC/flanabot?style=flat
|
||||||
:target: https://github.com/AlberLC/flanabot/blob/main/LICENSE
|
:target: https://github.com/AlberLC/flanabot/blob/main/LICENSE
|
||||||
@@ -26,3 +44,5 @@ Python 3.10 or higher is required.
|
|||||||
.. |python_version| image:: https://img.shields.io/pypi/pyversions/flanabot
|
.. |python_version| image:: https://img.shields.io/pypi/pyversions/flanabot
|
||||||
:target: https://www.python.org/downloads/
|
:target: https://www.python.org/downloads/
|
||||||
:alt: PyPI - Python Version
|
:alt: PyPI - Python Version
|
||||||
|
|
||||||
|
.. _github.com/AlberLC/multibot: https://github.com/AlberLC/multibot
|
||||||
@@ -568,6 +568,7 @@ class FlanaBot(MultiBot, ABC):
|
|||||||
user_names_with_at_sign = {user.name.lower() for user in message.chat.users}
|
user_names_with_at_sign = {user.name.lower() for user in message.chat.users}
|
||||||
user_names_without_at_sign = {user.name.lower().replace('@', '') for user in message.chat.users}
|
user_names_without_at_sign = {user.name.lower().replace('@', '') for user in message.chat.users}
|
||||||
original_text_words = flanautils.remove_accents(message.text.lower())
|
original_text_words = flanautils.remove_accents(message.text.lower())
|
||||||
|
original_text_words = original_text_words.replace(',', ' ').replace(';', ' ').replace('-', ' -')
|
||||||
original_text_words = flanautils.translate(
|
original_text_words = flanautils.translate(
|
||||||
original_text_words,
|
original_text_words,
|
||||||
{symbol: None for symbol in set(flanautils.SYMBOLS) - {'-', '.'}}
|
{symbol: None for symbol in set(flanautils.SYMBOLS) - {'-', '.'}}
|
||||||
@@ -580,17 +581,19 @@ class FlanaBot(MultiBot, ABC):
|
|||||||
- flanautils.cartesian_product_string_matching(original_text_words, constants.KEYWORDS['thanks'], min_ratio=0.85).keys()
|
- flanautils.cartesian_product_string_matching(original_text_words, constants.KEYWORDS['thanks'], min_ratio=0.85).keys()
|
||||||
- user_names_with_at_sign
|
- user_names_with_at_sign
|
||||||
- user_names_without_at_sign
|
- user_names_without_at_sign
|
||||||
- flanautils.CommonWords.words
|
- flanautils.CommonWords.all_words
|
||||||
)
|
)
|
||||||
if not place_words:
|
if not place_words:
|
||||||
await self.send_error(random.choice(('¿Tiempo dónde?', 'Indica el sitio.', 'Y el sitio?', 'y el sitio? me lo invento?')), message)
|
if not message.is_inline:
|
||||||
|
await self.send_error(random.choice(('¿Tiempo dónde?', 'Indica el sitio.', 'Y el sitio?', 'y el sitio? me lo invento?')), message)
|
||||||
return
|
return
|
||||||
|
|
||||||
if 'calle' in original_text_words:
|
if 'calle' in original_text_words:
|
||||||
place_words.insert(0, 'calle')
|
place_words.insert(0, 'calle')
|
||||||
place_query = ' '.join(place_words)
|
place_query = ' '.join(place_words)
|
||||||
if len(place_query) >= constants.MAX_PLACE_QUERY_LENGTH:
|
if len(place_query) >= constants.MAX_PLACE_QUERY_LENGTH:
|
||||||
await self.send_error(Media('resources/mucho_texto.png'), message)
|
if not message.is_inline:
|
||||||
|
await self.send_error(Media(str(flanautils.resolve_path('resources/mucho_texto.png'))), message, send_as_file=False)
|
||||||
return
|
return
|
||||||
if show_progress_state:
|
if show_progress_state:
|
||||||
bot_state_message = await self.send(f'Buscando "{place_query}" en el mapa 🧐...', message)
|
bot_state_message = await self.send(f'Buscando "{place_query}" en el mapa 🧐...', message)
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ asgiref==3.4.1
|
|||||||
async-generator==1.10
|
async-generator==1.10
|
||||||
async-timeout==3.0.1
|
async-timeout==3.0.1
|
||||||
attrs==21.4.0
|
attrs==21.4.0
|
||||||
|
beautifulsoup4==4.10.0
|
||||||
certifi==2021.10.8
|
certifi==2021.10.8
|
||||||
cffi==1.15.0
|
cffi==1.15.0
|
||||||
chardet==4.0.0
|
chardet==4.0.0
|
||||||
@@ -23,6 +24,7 @@ h11==0.12.0
|
|||||||
hachoir==3.1.2
|
hachoir==3.1.2
|
||||||
idna==3.3
|
idna==3.3
|
||||||
iso8601==1.0.2
|
iso8601==1.0.2
|
||||||
|
jellyfish==0.9.0
|
||||||
kaleido==0.2.1
|
kaleido==0.2.1
|
||||||
mpmath==1.2.1
|
mpmath==1.2.1
|
||||||
multibot
|
multibot
|
||||||
|
|||||||
0
tests/unit/__init__.py
Normal file
0
tests/unit/__init__.py
Normal file
@@ -2,7 +2,7 @@ import os
|
|||||||
|
|
||||||
import flanautils
|
import flanautils
|
||||||
|
|
||||||
os.environ |= flanautils.find_environment_variables('../../.env')
|
os.environ |= flanautils.find_environment_variables('../.env')
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from typing import Iterable
|
from typing import Iterable
|
||||||
|
|||||||
Reference in New Issue
Block a user