Задать вопрос
  • Не могу сделать миграцию, как это решить?

    Vindicar
    @Vindicar
    Maruf, либо другие прописали значение по умолчанию, либо не поставили ограничение NOT NULL, либо у них таблица пустая.
  • Как удалить надпись, вы подписаны на этот канал?

    Vindicar
    @Vindicar
    Дмитрий, читай документацию на aiogram и экспериментируй. Помимо message_handler, aiogram позволяет реагировать на разные события - см. channel_post_handler и т.п. Попробуй написать пробного бота который подписывается на все типы событий в канале, которые найдешь, и выводит в консоль информацию о них. Потом подпишись/отпишись пару раз, пока бот активен.
    Если ни одно из выведенных событий не будет соответствовать искомому сообщению, то тогда одно из трёх:
    1. ты упустил какой-то тип события
    2. aiogram не предоставляет возможности обработать этот тип события
    3. telegram не посылает это событие боту
  • Как удалить надпись, вы подписаны на этот канал?

    Vindicar
    @Vindicar
    Дмитрий, речь как раз об этом - ты уверен, что бот знает о существовании этого сообщения?
    Потому что вполне вероятно, что оно видимо только конкретному подписавшемуся пользователю.
    Попробуй получить список последних сообщений в канале, или вообще отслеживать все сообщения подряд, и удостоверься, что бот это сообщение тоже видит.
  • Как удалить надпись, вы подписаны на этот канал?

    Vindicar
    @Vindicar
    А боту вообще должно быть видно это сообщение?
  • Где скачать кроссплатформенный синтез речи для pyttsx3 python?

    Vindicar
    @Vindicar
    Python Новичок, такие вещи, насколько я знаю, не кроссплатформенные от слова совсем. Ну разве что ты настроишь pyttsx3 на использование облачного бэкэнда, со всеми вытекающими.
  • Где скачать кроссплатформенный синтез речи для pyttsx3 python?

    Vindicar
    @Vindicar
    > Он может брать голоса из windows (использую windows).
    > кроссплатформенный синтез речи
    Выбери что-то одно.
    А вообще, запрос в гугл вида "windows download TTS voice pack" должен дать желаемое.
  • Как настроить голосование в боте дискорд?

    Vindicar
    @Vindicar
    DeDabby, еще раз ,что непонятного?
    Ты знаешь, как выделить реакции с нужной иконкой в отдельный список.
    Получить длину списка - тривиально.
    Строишь два списка, один для ✅ и один для ❌, считаешь их длины, сравниваешь.
    Некрасиво, но работать будет.

    Ну или берешь мой код за основу.
  • Oracle Cloud: как отладить фаерволл, который режет HTTPS?

    Vindicar
    @Vindicar Автор вопроса
    Александр Карабанов, о! Сработало! Спасибо огромное!
    Использовал iptables-save и iptables-restore для этой цели.
  • В чем проблема кода, как исправить?

    Vindicar
    @Vindicar
    oiaya, прочитай комментарий еще раз и внимательно. Для вставки кода есть кнопка </>. Вперёд.
  • Oracle Cloud: как отладить фаерволл, который режет HTTPS?

    Vindicar
    @Vindicar Автор вопроса
    Александр Карабанов,
    iptables -S
    ubuntu@nextcloud-instance:~$ sudo iptables -S
    -P INPUT ACCEPT
    -P FORWARD ACCEPT
    -P OUTPUT ACCEPT
    -N InstanceServices
    -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
    -A INPUT -p icmp -j ACCEPT
    -A INPUT -i lo -j ACCEPT
    -A INPUT -p udp -m udp --sport 123 -j ACCEPT
    -A INPUT -i ens3 -p tcp -m tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
    -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
    -A INPUT -j REJECT --reject-with icmp-host-prohibited
    -A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
    -A INPUT -d 169.254.169.254/32 -p tcp -m tcp --dport 443 -j ACCEPT
    -A FORWARD -j REJECT --reject-with icmp-host-prohibited
    -A OUTPUT -d 169.254.0.0/16 -j InstanceServices
    -A InstanceServices -d 169.254.0.2/32 -p tcp -m owner --uid-owner 0 -m tcp --dport 3260 -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j ACCEPT
    -A InstanceServices -d 169.254.2.0/24 -p tcp -m owner --uid-owner 0 -m tcp --dport 3260 -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j ACCEPT
    -A InstanceServices -d 169.254.4.0/24 -p tcp -m owner --uid-owner 0 -m tcp --dport 3260 -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j ACCEPT
    -A InstanceServices -d 169.254.5.0/24 -p tcp -m owner --uid-owner 0 -m tcp --dport 3260 -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j ACCEPT
    -A InstanceServices -d 169.254.0.2/32 -p tcp -m tcp --dport 80 -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j ACCEPT
    -A InstanceServices -d 169.254.169.254/32 -p udp -m udp --dport 53 -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j ACCEPT
    -A InstanceServices -d 169.254.169.254/32 -p tcp -m tcp --dport 53 -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j ACCEPT
    -A InstanceServices -d 169.254.0.3/32 -p tcp -m owner --uid-owner 0 -m tcp --dport 80 -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j ACCEPT
    -A InstanceServices -d 169.254.0.4/32 -p tcp -m tcp --dport 80 -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j ACCEPT
    -A InstanceServices -d 169.254.169.254/32 -p tcp -m tcp --dport 80 -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j ACCEPT
    -A InstanceServices -d 169.254.169.254/32 -p udp -m udp --dport 67 -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j ACCEPT
    -A InstanceServices -d 169.254.169.254/32 -p udp -m udp --dport 69 -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j ACCEPT
    -A InstanceServices -d 169.254.169.254/32 -p udp -m udp --dport 123 -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j ACCEPT
    -A InstanceServices -d 169.254.0.0/16 -p tcp -m tcp -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j REJECT --reject-with tcp-reset
    -A InstanceServices -d 169.254.0.0/16 -p udp -m udp -m comment --comment "See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule" -j REJECT --reject-with icmp-port-unreachable

    Хмм, видна разница между правилами для 80 и 443...
  • Oracle Cloud: как отладить фаерволл, который режет HTTPS?

    Vindicar
    @Vindicar Автор вопроса
    Lynn «Кофеман», я думаю, может зависеть от порта если фаервол режет.
    Я даже так сделал:
    traceroute --tcp -p 80 instance.address
    и так
    traceroute --tcp -p 443 instance.address
    В первом случае трейс проходит, во втором - доходит до узла инстанса, но выдаёт вот такое
    [instance IPv4] ([instance IPv4])  28.441 ms !X  28.440 ms !X  28.406 ms !X

    В мане написано,
    !X (communication administratively prohibited)
    .
  • Oracle Cloud: как отладить фаерволл, который режет HTTPS?

    Vindicar
    @Vindicar Автор вопроса
    Lynn «Кофеман», пардон, протупил.
    curl -vk http://istance.address
    * Rebuilt URL to: http://istance.address/
    * Hostname was NOT found in DNS cache
    *   Trying [instance IPv4]...
    * Connected to istance.address ([instance IPv4]) port 80 (#0)
    > GET / HTTP/1.1
    > User-Agent: curl/7.35.0
    > Host: istance.address
    > Accept: */*
    >
    < HTTP/1.1 200 OK
    < Date: Sat, 08 Jan 2022 12:24:56 GMT
    * Server Apache/2.4.41 (Ubuntu) is not blacklisted
    < Server: Apache/2.4.41 (Ubuntu)
    < Vary: Accept-Encoding
    < Content-Length: 765
    < Content-Type: text/html;charset=UTF-8
    <
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
    <html>
     <head>
      <title>Index of /</title>
     </head>
     <body>
    <h1>Index of /</h1>
      <table>
       <tr><th valign="top"><img src="/icons/blank.gif" alt="[ICO]"></th><th><a href="?C=N;O=D">Name</a></th><th><a href="?C=M;O=A">Last modified</a></th><th><a href="?C=S;O=A">Size</a></th><th><a href="?C=D;O=A">Description</a></th></tr>
       <tr><th colspan="5"><hr></th></tr>
    <tr><td valign="top"><img src="/icons/folder.gif" alt="[DIR]"></td><td><a href="nextcloud/">nextcloud/</a></td><td align="right">2021-11-26 20:51  </td><td align="right">  - </td><td>&nbsp;</td></tr>
       <tr><th colspan="5"><hr></th></tr>
    </table>
    <address>Apache/2.4.41 (Ubuntu) Server at istance.address Port 80</address>
    </body></html>
    * Connection #0 to host istance.address left intact
  • Oracle Cloud: как отладить фаерволл, который режет HTTPS?

    Vindicar
    @Vindicar Автор вопроса
    61d97fd5529ed417717605.png
    Насколько я понял - да. Эти правила были актуальны на момент написания вопроса и остаются актуальными сейчас. Пробовал также делать только Stateful Ingress правила (в доках оракла написано, что так тоже сработает) - не пашет с теми же симптомами.
  • Oracle Cloud: как отладить фаерволл, который режет HTTPS?

    Vindicar
    @Vindicar Автор вопроса
    Lynn «Кофеман»,
    curl -vk https://instance.address
    * Rebuilt URL to: https://instance.address/
    * Hostname was NOT found in DNS cache
    *   Trying [instance IPv4]...
    * connect to [instance IPv4] port 443 failed: No route to host
    * Failed to connect to istance.address port 443: No route to host
    * Closing connection 0
    curl: (7) Failed to connect to istance.address port 443: No route to host
  • Почему if не видит слово?

    Vindicar
    @Vindicar
    Ну или еще проще: print(repr(line))
  • Как сделать чтобы бот пинговал двух указанных пользователей на discord.py?

    Vindicar
    @Vindicar
    darwinpython, а если почитать свой код?
    if msg is None:
    Значит, код ниже выполнится только если msg - None. И в коде ниже ты обращаешься к msg.author.mention. Которого не может существовать, потому что msg - None.
  • Как NTFS удаётся хранить файлы размером больше 4Gb?

    Vindicar
    @Vindicar
    От себя добавлю - ряд функций WinAPI для работы с файлами позволяет указать 64битный размер файла (или смещение внутри файла) как два 32битных целых (младшие и старшие 4 байта).
  • Как сделать команду avatar на discord.py?

    Vindicar
    @Vindicar
    Взять и сделать. Чем конкретно затруднение, и что сделано на текущий момент?
  • Ветвление на основе типа?

    Vindicar
    @Vindicar
    mkone112, интерпретатор питона вообще игнорирует type hints при работе, если только код явно не использует reflection чтобы их просмотреть. Собственно, даже runtime checkable протоколы в итоге содержат пачку if, проверяющих наличие нужных методов и полей в объекте.
    Так что вариантов-то особо и нет, учитывая что дженерики нельзя быстро проверить через isinstance(). Вместо этого придётся разбирать параметры дженерика и проверять всё по отдельности, что абсолютно не универсально и очень муторно.