@luckydonaldsbots · Post #256 · 08.07.2020 г., 23:11
New feature I forgot to write about, @BanWarnBot will now also notice you if a user which already has gotten warns joins back into your group. #update#BanWarnBot.
Hashtags
TGINSIGHT SIMILAR POSTS
Изворен канал @pythonotes · Post #32 · 7 фев.
Скорее всего уже слышали, что складывать строки через + это плохая практика. Падение производительности, и всё такое. Без лишних слов, давайте измерять: from timeit import timeit def t1(): # складываем 10 строк через + из переменной t = 'text' for _ in range(1000): s = t + t + t + t + t + t + t + t + t def t2(): # склеиваем список строк через метод join arr = ['text'] * 10 for _ in range(1000): s = ''.join(arr) def t3(): # складываем через + но не из переменной а непосредственно инлайн объекты for _ in range(1000): s = 'text' + 'text' + 'text' + ... # всего 10 раз Теперь каждую строку склейки запустим по 10М раз >>> timeit(t1, number=10000) 0.21951690399964718 >>> timeit(t2, number=10000) 1.4978306379998685 >>> timeit(t3, number=10000) 0.2213820789993406 Хм, а нам говорили что через "+" это плохо и медленно ))) 😁 Тут стоит учитывать, что речь идёт о склейке множества длинных строк. Давайте изменим условия: def t4(): t = 'text'*100 for _ in range(1000): s = t + t + t + t + t + t + t + t + t def t5(): arr = ['text'*100] * 10 for _ in range(1000): s = ''.join(arr) def t6(): for _ in range(1000): s = 'text'*100 + 'text'*100 + ... # всего 10 раз >>> timeit(t4, number=10000) 12.795130728000004 >>> timeit(t5, number=10000) 2.642637542999182 >>> timeit(t6, number=10000) 0.2184546610005782 Вот, уже другой разговор, сразу видна разница, в среднем в 6 раз. Но погодите, почему последний тест t6() по скорости такой же как и t3()? Ведь строки теперь в 100 раз длиннее! Это вопросы оптимизации кода, какие простые изменения ускоряют или замедляют выполнение программы. Мы столкнулись с примером обхода обращения к переменной. Например, именно так работает директива #define в С++, во время компиляции подставляя значение переменной вместо ссылки на неё. В Python это тоже работает, но часто ли вы сможете встретить такой способ работы со строками? К сожалению, способ почти только теоретический. В целом, тесты показали то, что мы хотели. Делаем выводы самостоятельно. Полный листинг 🌍 #tricks
Пребарај: #banwarnbot
@luckydonaldsbots · Post #256 · 08.07.2020 г., 23:11
New feature I forgot to write about, @BanWarnBot will now also notice you if a user which already has gotten warns joins back into your group. #update#BanWarnBot.
Hashtags
@luckydonaldsbots · Post #138 · 05.07.2018 г., 20:26
Updated @BanWarnBot to no longer kick people when revoking warns. The technical details: Telegrams unbanChatMember API method is actually is a kick+unban, which isn't documented anywhere. It will now check first if the user is not member of the group, being kicked (=banned) or the user left the group (or "was forcefully left by admins"). Else it will not attempting to unban the use as that would kick, too. #update#BanWarnBot
Hashtags
@luckydonaldsbots · Post #133 · 04.07.2018 г., 11:17
@BanWarnBot now allows to revoke warnings by clicking on a button right under it. #update#BanWarnBot
Hashtags
@luckydonaldsbots · Post #300 · 12.11.2025 г., 07:19
Experienced another way how the disk can run full, deleted 100 GB of ancient pending RabbitMQ tasks and set a message TTL as well as a maximum queue length. With that the bots are back online. #JoinCaptchaBot #BanWarnBot
Hashtags
@luckydonaldsbots · Post #299 · 05.06.2024 г., 22:18
Some bots were down again, which was caused by the disk running full. Deleted 460 GB of log files and restored the services. Bots will process all pending updates normally. #JoinCaptchaBot#BanWarnBot
Hashtags
@luckydonaldsbots · Post #252 · 04.07.2020 г., 15:57
@BanWarnBot is nowsuccessfully back up and running the newest version: Here's a list of what's new: New /kick and /ban commands: Just like the /warn one, but immediately removes the user from the chat, either once or permanently. You can specify a reason for why you kicked/banned someone after the command. Those kicks count into the normal warn count, because they are kinda like special warns. Those 3 commands, /warn, /kick and /ban now also allow the first thing after the command to be the id of a user, in the format of #1234, or a user mention. This can come in handy if you don't have a message to reply to. Overhaul of the warning lists: Now the list of /listwarnings and /listallwarnings will link you to the message warn message, if you press the date stamp. Also support for distinguishing automatic kicks/bans and manual kicks/bans has been added. #update#BanWarnBot#resolved
Hashtags
@luckydonaldsbots · Post #251 · 04.07.2020 г., 14:51
Maintenance: Moving @BanWarnBot to the new server. Okey going through the same procedure for @BanWarnBot now, hopefully without the database breaking this time. Turning the bot off for moving the database, so any /warns send in the meantime shouldn't get lost. As soon as it's on the new server it should pick up those, and carry out the needed actions. I'll take @BanWarnBot down in 10 minutes. Other bots should not be affected. #maintenance#downtime#BanWarnBot
Hashtags
@luckydonaldsbots · Post #295 · 15.12.2021 г., 23:01
It was brought to attention that with some bots admin commands were no longer working. That was happining for the bots migrated yesterday, because of the new bot API version. This is #fixed now. Thanks for letting me know, A. A.! #BanWarnBot#RulesRulesBot#JoinCaptchaBot
@luckydonaldsbots · Post #232 · 24.03.2020 г., 10:45
I will soon migrage some services onto a new server. Therefore those services will be unavailable for the next two hours: @JoinCaptchaBot@BanWarnBot@RulesRulesBot and @ForwardWhitelistBot. #downtime #JoinCaptchaBot#BanWarnBot#RulesRulesBot#ForwardWhitelistBot
@luckydonaldsbots · Post #230 · 23.03.2020 г., 11:24
I will definitely work hard to keep the most important group management services stable, including: @JoinCaptchaBot, @RulesRulesBot, @BanWarnBot, and @HeyAdminBot. And for now also the less important @NoServiceBot. #PermalinkBot#NoServiceBot#RulesRulesBot, #BanWarnBot#HeyAdminBot #ongoing#issue