vldc-hq / vldc-bot Goto Github PK
View Code? Open in Web Editor NEWThe official VLDC telegram group bot
Home Page: https://vldc.org
License: MIT License
The official VLDC telegram group bot
Home Page: https://vldc.org
License: MIT License
Plus:
config
smile_bot
by vldc_bot
in the VLDC chatThe main problem right meaw than once kicked user can't retry to join the chat.
bot_1 | 2019-09-24 00:05:56,590 - skills.since_mode - INFO - topic from db for title I been gone is None
bot_1 | 2019-09-24 00:05:56,590 - telegram.ext.dispatcher - ERROR - An uncaught error was raised while processing the update
bot_1 | Traceback (most recent call last):
bot_1 | File "/usr/local/lib/python3.7/site-packages/python_telegram_bot-12.0.0b1-py3.7.egg/telegram/ext/dispatcher.py", line 333, in process_update
bot_1 | handler.handle_update(update, self, check, context)
bot_1 | File "/usr/local/lib/python3.7/site-packages/python_telegram_bot-12.0.0b1-py3.7.egg/telegram/ext/handler.py", line 117, in handle_update
bot_1 | return self.callback(update, context)
bot_1 | File "/app/bot/skills/since_mode.py", line 79, in since_callback
bot_1 | update.message.reply_text(
bot_1 | AttributeError: 'NoneType' object has no attribute 'reply_text'
Just reply pong
for ping
command, and remove both messages after a few seconds.
To be sure bot is up
Every mode should have modeName_on
and modeName_off
handlers, to change the state of mode by admins, without restart container.
It should be decorator for add_MODENAME_handlers
.
GROUP_CHAT_ID
from ENVAdd "cleanup" decorator for modes and commands.
This decorator should take a number of seconds as a parameter, and provide the removing affected messages (user cmd, bot answers) after a while.
For example:
@cleanup(600)
def add_roll(upd: Updater, handlers_group: int):
logger.info("registering roll handlers")
dp = upd.dispatcher
dp.add_handler(CommandHandler("roll", roll), handlers_group)
should looks in the chat like:
u1: /roll
bot: 💥 boom! u 😵 [8h mute]
u2: лол
u3: кек
u3: чебурек
after 10 minutes messages u1: /roll
and bot: 💥 boom! u 😵 [8h mute]
should be removed
@C-Pro I believe you know much more about this.
Why choose Python for literally anything in 2k19? It's slow, unsafe, have poor ergonomics and just not good enough for modern development.
Have you heard about Rust? Rust is a statically typed language with strong safety guarantees, native performance and zero-overhead abstractions. It's super-duper cool, makes your code bugs-free and super fast. For free! And it's super popular and will bring you tens and hundreds of new contributors!
For ppl who don't know what smile mode is
For some reason, the built-in message is not shown in the VLDC chat
/uwu
I believe barrel should be loaded randomly every turn
/version
should print version\build code and probably hostname
bot_1 | 2019-09-24 05:18:08,146 - skills.since_mode - INFO - topic from db for title 72k is None
bot_1 | 2019-09-24 05:20:34,343 - skills.since_mode - INFO - topic from db for title Баг is None
bot_1 | 2019-09-24 05:20:49,825 - skills.since_mode - INFO - topic from db for title бАг is None
bot_1 | 2019-09-24 05:21:40,150 - skills.since_mode - INFO - topic from db for title Баг is None
bot_1 | 2019-09-24 05:21:44,787 - skills.since_mode - INFO - topic from db for title Баг is None
bot_1 | 2019-09-24 05:21:54,895 - skills.since_mode - INFO - topic from db for title Баг is None
user2: /why как найти работу программистом если тебе больше 22 лет?
nayb: Хотелось бы узнать мнение @KittyHawk1 по поводу вопроса: как найти работу программистом если тебе больше 22 лет?
2019-11-08 08:39:55,409 - telegram.utils.promise - ERROR - An uncaught error was raised while running the promise
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/python_telegram_bot-12.0.0b1-py3.7.egg/telegram/utils/promise.py", line 57, in run
self._result = self.pooled_function(*self.args, **self.kwargs)
File "/app/bot/skills/towel_mode.py", line 176, in ban_user
chat_id = context.bot.get_chat(chat_id=context.job.context["chat_id"]).id
File "/usr/local/lib/python3.7/site-packages/python_telegram_bot-12.0.0b1-py3.7.egg/telegram/bot.py", line 66, in decorator
result = func(self, *args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/python_telegram_bot-12.0.0b1-py3.7.egg/telegram/bot.py", line 2159, in get_chat
result = self._request.post(url, data, timeout=timeout)
File "/usr/local/lib/python3.7/site-packages/python_telegram_bot-12.0.0b1-py3.7.egg/telegram/utils/request.py", line 327, in post
**urlopen_kwargs)
File "/usr/local/lib/python3.7/site-packages/python_telegram_bot-12.0.0b1-py3.7.egg/telegram/utils/request.py", line 238, in _request_wrapper
raise BadRequest(message)
telegram.error.BadRequest: Chat not found
Need to duplicate all bots messages in two languages. For some reasons, someone from the chat believes it will be a good option for a chat in Russian, idk. And, maybe new users will read bots messages more carefully.
Now: 8-16-24-32-40-48
Proposal: 24-48-72-96-120-144
Add roll /roll
support. This is command for regular users only (not for admins).
u1: /roll
bot: miss!
u2: /roll
bot: miss!
u1: /roll
bot: Boom! Mute for u1 for 24 hours
Note: chance to being shoot is 1/6
Remove original /still smth
message after bot posted answer
since-mode
is counting and showing numbers of days since last mentation of our favorite themes.
It may be two option probably: catch themes buzz words in the messages, or use /since_
command.
For example:
user: ну вообще, ООП решает эту проблему
vldc_bot: This is are 0 days since ООП discussion
or
user: современный php – не такой плохой язык, им вполне можно пользоваться
user2: /since_php
vldc_bot: This is are 2 days since Современный ПеХеПе discussion
For these two options, we need the preselected list of our favorite themes.
Alternativly, we may allow users creating they owns since-words, like:
user: да макось вообще не позволяет ничего кастомизировать, толи дело арч
user2: /since бест ОС евер
vldc_bot: This is are 0 days since бест ОС евер discussion
В таком случае можно добавить вывод всех since за все время:
user: /since_all
vldc_bot:
ООП: 0 days
Современный ПеХеПе: 20 days
бест ОС евер: 2 days
Obviously, we need some persistent storage for this kind of stuff. Let's say it will be mongo
If the user presses the button, we don't need to show a greeting message anymore
bot_1 | 2019-10-29 16:04:26,084 - telegram.utils.promise - ERROR - An uncaught error was raised while running the promise
bot_1 | Traceback (most recent call last):
bot_1 | File "/usr/local/lib/python3.7/site-packages/python_telegram_bot-12.0.0b1-py3.7.egg/telegram/utils/promise.py", line 57, in run
bot_1 | self._result = self.pooled_function(*self.args, **self.kwargs)
bot_1 | File "/app/bot/skills/towel_mode.py", line 179, in ban_user
bot_1 | _delete_user_rel_messages(chat_id, user["_id"], context)
bot_1 | File "/app/bot/skills/towel_mode.py", line 68, in _delete_user_rel_messages
bot_1 | context.bot.delete_message(chat_id, msg_id)
bot_1 | File "/usr/local/lib/python3.7/site-packages/python_telegram_bot-12.0.0b1-py3.7.egg/telegram/bot.py", line 66, in decorator
bot_1 | result = func(self, *args, **kwargs)
bot_1 | File "/usr/local/lib/python3.7/site-packages/python_telegram_bot-12.0.0b1-py3.7.egg/telegram/bot.py", line 292, in delete_message
bot_1 | result = self._request.post(url, data, timeout=timeout)
bot_1 | File "/usr/local/lib/python3.7/site-packages/python_telegram_bot-12.0.0b1-py3.7.egg/telegram/utils/request.py", line 327, in post
bot_1 | **urlopen_kwargs)
bot_1 | File "/usr/local/lib/python3.7/site-packages/python_telegram_bot-12.0.0b1-py3.7.egg/telegram/utils/request.py", line 238, in _request_wrapper
bot_1 | raise BadRequest(message)
bot_1 | telegram.error.BadRequest: Message to delete not found
u1: *bunch of arguments*
u2: yeee, but why not Rust?
u1: Gosh, fuck this shit
u1: /ban_me
bot: User u1 was banned (for 24h)
@C-Pro wtf???
Let's use come GitHub actions magic!
What we should add to our quality gate?
build:
upd: for now, I'll restart container manually (meh)
We need to add /soon
, /events
and /add_event
commands.
For admins: /add_event
will add event date, links and short description of the event.
For all:
/soon
– show info about the soonest event/events
– show list of the last N eventsAs usual:
core
skilluser: /ci
boy: @cpro29a, как там ci? ;)
X-Mas is so near! The current leaderboard created by @C-Pro link: https://adventofcode.com/2019/leaderboard/private/view/458538
I believe bot should post it for /tree
command
See #34
@C-Pro could you add some automation for deployment each new version?
After each push into master Docker Hub will build the new latest version on the container. And, looks like we may just pull new container, but sometimes we are updating the docker-compose (for adding new services for example), and at this case, we need more smartest deploy.
We may user GitHub Actions for this purpose, I guess. So, I believe it may look like:
@lamak now it is your horse 🐴
I believe it should be a custom Tg keyboard with all subjects as buttons.
User may use /since
cmd, and then only this user will see the keyboard, and make a choice, wich one subject must be updated.
Only admins can add subjects. Let's say by /since_add
cmd.
And we need some anti-flood protection I guess.
Temporarily disable any non-essential features, like /uwu
, /still
etc., sometimes there's too much junk.
Suggested behaviours:
/smile
or /since
.Add the list of strong \ abusive words to immediately removing msg with them. For example:
user: доброго времени суток, коллеги
vldc_bot: коллеги? no way!
# remove the msg
u1: да там надо шоткат из 12 кнопок добавить и все будет работать
u2: /still вим настраивать
bot: Вот бы сейчас вим настраивать в 2k19 LULW
To make more attention for bots message.
458538-e2a0698b
Something like /mute @C-Pro 90
for muting (removing all messages) by user @C-Pro during 90 minutes
remove all related ci
cmd
Need to update /still
command: replace 2k19
to 2k20
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.