DOS is still used by many people...
Not authorized

Registration date is not available.
Login | Register | Users

Forums Home
Web-chat
Guestbook
Inbox
Articles
Users List
Profile
Profile Logs
News
Services Page
Search
Jokes Script
Weather Informer
Web-ring
Visitors Counter
Search
Hosting
E-Mail
Journal "Elpis"
Templates for Sites

Downgrade > Forums > > Библиотека pycq работает с KICQ.


<< < Page 1 of 1 > >>

BitByByte

Member since Feb 25, 2025
Недавно, я наконец-то смог починить библиотеку pycq (написанную в 2001 году для Python версии 2.4) для полноценной работы с KICQ. Исходный код загружен на GitHub: https://github.com/tankwars92/pykicq.

Для того, чтобы было понятно, почему это - важно, давайте разберём пример кода (простейший бот):

c=pycq()

c.connect()
while True:
p=c.main(10)
print p

if p and isinstance(p, list) and len(p) > 0 and isinstance(p[0], dict):
if 'uin' in p[0] and 'message_text' in p[0]:
p_uin = p[0]['uin']
p_message_text = p[0]['message_text']

if p_message_text == "!test":
c.send_message_server(p_uin, 'Hi. This is the pycqlibrary, corrected to work with the OSCAR "KICQ" server. Random number (1-100): ' + str(random.randint(1, 100)) + " :D. Send !logout message to logout gracefully. Russian message test: \xcf\xf0\xe8\xe2\xe5\xf2.")
elif p_message_text == "!logout":
c.send_message_server(p_uin, "Goodbye!")
c.logout()
break

То есть, это ничуть не хуже всяких библиотек для Telegram или Discord ботов. Обратите внимание! Всегда корректно завершайте сессию с работой учётной записи: используйте c.logout()! Иначе, есть шанс получить "ошибку резервной схемы".
Posted Mar 30, 2025, 09:00 AM Quote


Copyright (c) 2025, Downgrade.
Please ask questions and report any problems on our forum.
Downgrade Net Banner

Visitor Counter
0007958
Here is a list of Downgrade users.