GithubHelp home page GithubHelp logo

bot-python's People

Contributors

aidarazizov avatar antonpasiy avatar dasshit avatar dependabot[bot] avatar esineokov avatar igor-anferov avatar kvaleryi avatar sergey-gladkow avatar shvedoff avatar testesin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bot-python's Issues

Не сбрасывается кэш действий при нажатии на кнопку

Сценарий такой:

  1. пишу функционал колбэка на нажатие кнопки
  2. запускаю бота
  3. использую кнопку
  4. меняю функционал колбэка и перезапускаю бота
  5. при использовании кнопки работает функционал пункта 1, вместо пункта 4

Не нашел встроенных методов исправить это

Wrong number of arguments in _signal_handler()

When I send Ctrl+C / SIGTERM to running bot script I got such errors (signal should be send twice to completely exit):

Traceback (most recent call last):
  File "/usr/local/bin/icqbot.py", line 510, in <module>
    main()
  File "/usr/local/bin/icqbot.py", line 87, in main
    run_service()
  File "/usr/local/bin/icqbot.py", line 121, in run_service
    bot.idle()
  File "/usr/local/lib/python-venv/icqbot/lib/python3.7/site-packages/bot/bot.py", line 155, in idle
    sleep(1)
TypeError: _signal_handler() takes 2 positional arguments but 3 were given
Exception ignored in: <module 'threading' from '/usr/lib/python3.7/threading.py'>
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 1281, in _shutdown
    t.join()
  File "/usr/lib/python3.7/threading.py", line 1032, in join
    self._wait_for_tstate_lock()
  File "/usr/lib/python3.7/threading.py", line 1048, in _wait_for_tstate_lock
    elif lock.acquire(block, timeout):
TypeError: _signal_handler() takes 2 positional arguments but 3 were given

I think error because of

signal.signal(signalnum, handler)
The handler is called with two arguments: the signal number and the current stack frame (None or a frame object; for a description of frame objects, see the description in the type hierarchy or see the attribute descriptions in the inspect module).

but _signal_handler() want to get only one argument (after self), not two.

def _signal_handler(self, sig: int):

Помогите с функцией "mute"

Добрый день . Хочу создать бота модератора для своих сообществ ICQ и столкнулся с проблемой, не могу найти функцию "mute" - пользователей, а она мне очень нужна для модерации чатов. Не могли бы вы мне помочь с этим вопросом? У вас в тестовом боте я нашел только функцию блока пользователей.

# Block user in chat
bot.chat_block_user(chat_id=TEST_CHAT, user_id=TEST_USER, del_last_messages=True)
# Unlock user in chat
bot.chat_unblock_user(chat_id=TEST_CHAT, user_id=TEST_USER) 

Буду очень благодарен если поможете мне с моим вопросом.

Flask-style dispatcher

Flask-style dispatcher look pretty and simple.
It reduces entry threshold for beginners.
It makes code more clear and readable

@bot.message_handler(filters)
def function_name(message):
    bot.reply_to(message, "This is a message handler")

Reference:
aiogram
pyTelegramBotAPI

account sign in problem

It says invalid number if I try to sign in with my phone number . i am from bangladesh .numbers starts with +880

I can't add more of the 8 buttons in one message

def test_cb(bot, event):
bot.send_text(chat_id=event.data['chat']['chatId'],
text="Hello with buttons.",
inline_keyboard_markup="[{}]".format(dumps([
{"text": "Action 1", "url": "http://mail.ru"},
{"text": "Action 2", "callbackData": "call_back_id_2"},
{"text": "Action 3", "callbackData": "call_back_id_3"},
{"text": "Action 1", "url": "http://mail.ru"},
{"text": "Action 2", "callbackData": "call_back_id_2"},
{"text": "Action 3", "callbackData": "call_back_id_3"},
{"text": "Action 1", "url": "http://mail.ru"},
{"text": "Action 2", "callbackData": "call_back_id_2"},
{"text": "Action 3", "callbackData": "call_back_id_3"},
])))
How i can make more buttons?

Ссылка на изображение

Подскажите, можно ли как-то вытягивать ссылку на изображение из event. Изображение отправляют боту drag and drop или просто загружают через окно загрузки.

Ranaming local variable causing a bug

Hey

I took an example from documentation:

from bot.bot import Bot
from bot.handler import MessageHandler

TOKEN = "" #your token here

bot = Bot(token=TOKEN)

def message_cb(bot, event):
    bot.send_text(chat_id=event.from_chat, text=event.text)

bot.dispatcher.add_handler(MessageHandler(callback=message_cb))
bot.start_polling()
bot.idle()

The original example works nice. BUT if I rename bot to icq in message_cb function, then the bot does not send messages back to user. Other words, the code below does not work:

from bot.bot import Bot
from bot.handler import MessageHandler

TOKEN = "" #your token here

bot = Bot(token=TOKEN)

def message_cb(icq, event):
    icq.send_text(chat_id=event.from_chat, text=event.text)

bot.dispatcher.add_handler(MessageHandler(callback=message_cb))
bot.start_polling()
bot.idle()

Why is it?

inlineKeyboardMarkup не отправляется

пробую отправить клавиатуру, как показано в примере:

if __name__ == "__main__":
    bot = Bot(token=TOKEN, name=NAME, version=VERSION, api_url_base=API_URL)
    bot.send_text(chat_id='746691278',
                text=U"helo\n\rworld<a href='aaa'>aaa</a>",
                inline_keyboard_markup="[{}]".format(json.dumps([
                    {"text": "Action 1", "url": "http://mail.ru"},
                    {"text": "Action 2", "callbackData": "call_back_id_2"},
                    {"text": "Action 3", "callbackData": "call_back_id_3"}
                ])))
    bot.dispatcher.add_handler(BotButtonCommandHandler(callback=buttons_answer_cb))
    bot.idle()

сообщение отправляется, а клавиатуры нет.

api.icq.net is not accessible within docker container/api.icq.net не принимает запрос внутри docker контейнера

In English
I am currently designing a myteam-bot, that sends messages to the chat on particular event. Locally (Windows, Python3.6) within and without docker container this bot works very well. However when I wanted to deploy my project in Ubuntu 20.04 server it doesn't work within docker container. If I run my script with python3 test.py command without using docker container it works, however inside docker container request doesn't work. I also tried to make my script via request to api.icq.net, it doesn't work either.
But there is some info about container that I should tell you: my ubuntu server is connected to VPN, so that I can ping my server inside my local network. That's why I set network: host in my docker-compose.yml file, so that it could install all dependencies and libraries.
Therefore, I have two questions:

  1. How to make myteam-bot work inside my docker container with network:host and server connected to VPN?
  2. I might understand that the reason of it might be VPN and network:host parameter in docker-compose file, but when I make simple request to https website inside docker container this request works, but api.icq.net doesn't work. Why?

На русском
У меня есть myteam-бот, который работает прекрасно на моей винде как через python скрипт, так и внутри докера. Однако когда я хочу задеплоить тот же самый проект на сервере Ubuntu 20.04 бот не отправляет сообщение в чат. И я не понимаю в чем дело, ведь если запустить python скрипт на сервере, то сообщение приходит. А если поднять докер контейнер, то сообщение не приходит.
Вдобавок должен сказать, что сервер подключен к VPN, чтобы можно было пинговать сервера в другой сети. Поэтому чтобы запустить докер контейнер мне пришлось добавить в мой сервис в docker-compose network:host - что помогло скачать все библиотеки.
Итак, у меня два вопроса:

  1. Как сделать так, чтобы бот заработал внутри докера с параметром network:host и сервером подключенным к VPN?
  2. Я могу понять что это все из-за VPN и этого параметра в докере(network:host), но тогда почему на другие https сайты я могу кинуть get запрос и он мне вернет 200, а бот же нет. Ни бот, ни api.icq.net не отправляют сообщения. Почему?

webhook support ?

hi i just wanted to ask if there is any plans to add webhook support to your bot api
best regards

Как передать file в POST методе send_file?

Как передать file в POST методе send_file? Когда указываю имя файла в виде строки, отправляется несозданный мной файл. Как же всё-таки передать файл в file?

Update dependencies versions

Наткнулся на проблему 'HTTPResponse' object has no attribute 'strict' при build проекта с ботом.

Нашел обсуждения уже в нескольких местах:
psf/cachecontrol#292

По предложенным вариантам решения не могу обновить версии зависимостей, т.к. в mailru-im-bot версии вшиты жестко к конкретным версиям.

Планируется обнолвение версий зависимостей ?

Tips needed ♥

Hi team from Russia,
I was asking myself, how do I dev a bot like yours, which can ask user some questions, then listen to their answer, then finally prints the final result ?
I want to improve it for my needs. So, Please could you help me to adopt the best solution.
How can I create a wizard from this bot ?
Good luck to you in this "complicated period"...
cheers.

Инструкции

Где можно найти инструкции??
https://agent.mail.ru/botapi/tutorial/
тут все сделал по инструкции
from bot.bot import Bot
from bot.handler import MessageHandler

TOKEN = "" #your token here

bot = Bot(token=TOKEN)

def message_cb(bot, event):
bot.send_text(chat_id=event.from_chat, text=event.text)

bot.dispatcher.add_handler(MessageHandler(callback=message_cb))
bot.start_polling()
bot.idle()

Не работает, в консоле python зависает и невозможно ничего сделать, соответственно бот тоже не отвечает на сообщения

import bot

Naming your library as a bot is a bad practice.
Not clear to users, not clear to dependencies.

Bot development is not just about you :)
A more suitable and clear name option is icq:

from icq import Bot

Unresolved reference 'bot'

Hi, i istalled this library first by git clone and setup, but terminal wrote: no module named steptools. I install pip and go sudo apt install python-pip. There is no errors. So when i copypast code from official bot api webcite i get this error in pycharm: Unresolved reference 'bot'
How can i solve this problem?

Phone Number

Is it possible to get the phone number for events?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.