TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #76 · 27 апр.

Ранее я делал серию постов про битовые операторы. Вот вам ещё один наглядный пример как это используется в Python в модуле re. Чтобы указать флаг для компилятора нам надо указать его после передаваемой строки. Например, добавляем флаг для игнорирования переноса строки. pattern = re.compile(r"(\w+)+") words = pattern.search(text, re.DOTALL) А как указать несколько флагов? Ведь явно будут ситуации когда нам потребуется больше одного. Кто читал посты по битовые операторы уже понял как. pattern.search(text, re.DOTALL | re.VERBOSE) А теперь смотрим исходники, что находится в этих атрибутах? Не удивительно, степени двойки. Почему? Потому что каждое следующее значение это сдвиг единицы влево. >>> for n in [1, 2, 4, 8, 16, 32, 64, 128, 256]: >>> print(bin(n)) 0b1 0b10 0b100 0b1000 0b10000 0b100000 0b1000000 0b10000000 0b100000000 Чтобы было понятней, давайте напишем тоже самое но иначе, добавим ведущие нули: 000000001 000000010 000000100 000001000 000010000 000100000 001000000 010000000 100000000 Не понятно что тут происходит? Читай три поста про битовые операторы начиная с этого ➡️https://t.me/pythonotes/45 В общем, это пример применения побитовых операций в самом Python. Теперь вы знаете Python еще немного лучше) #tricks#regex#libs

Резултати

Пронајдени 10 слични објави

Пребарај: #banwarnbot

当前筛选 #banwarnbot清除筛选
Luckydonalds Bots: Development/Status

@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

Luckydonalds Bots: Development/Status

@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

Luckydonalds Bots: Development/Status

@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

Luckydonalds Bots: Development/Status

@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