Skip to main content

An unofficial Python API for WOLF instant messaging platform

Project description

xwolfpython

An unofficial Python API for WOLF instant messaging platform. This is a Python port of the TypeScript WOLFApi-TS library.

Installation

pip install xwolfpython

Features

  • Connect to WOLF messaging platform
  • Send and receive messages (group and private)
  • Manage group memberships
  • Admin actions (ban, kick, silence, etc.)
  • User profile management
  • Group management
  • Charms and achievements
  • And much more!

Quick Start

from xwolfpython import WolfClient
from xwolfpython.types.types import DeviceType, OnlineState

bot = WolfClient()

@bot.On.LoginSuccess.setter
def on_login_success(user):
    print(f"Logged in as: {user.subscriber.get('nickname')}")

@bot.On.GroupMessage.setter
def on_group_message(msg):
    print(f"Group message: {msg.text}")

    # Reply to message
    bot.Messaging.reply(msg, "Hello from Python!")

bot.login("your_email", "your_password", DeviceType.WEB, OnlineState.ONLINE)

# Keep the bot running
import time
try:
    while True:
        time.sleep(1)
except KeyboardInterrupt:
    bot.logout()

Examples

Sending Messages

# Send group message
bot.Messaging.group_message(group_id, "Hello group!")

# Send private message
bot.Messaging.private_message(user_id, "Hello user!")

# Send image
bot.Messaging.group_message(group_id, "https://example.com/image.jpg", is_image=True)

Admin Actions

# Ban user
bot.Action.ban_user(group_id, user_id, lambda result: print(result.success))

# Kick user
bot.Action.kick_user(group_id, user_id)

# Silence user
bot.Action.silence_user(group_id, user_id)

# Reset user
bot.Action.reset_user(group_id, user_id)

Group Management

# Join group
bot.Action.join_group("group_name")

# Leave group
bot.Action.leave_group(group_id)

# Get group info
bot.Info.request_group(group_id, lambda group: print(group.name))

# Get group members
bot.Info.group_member_list(group_id, lambda members: print(len(members)))

User Information

# Get user profile
bot.Info.request_user(user_id, lambda user: print(user.nickname))

# Update bot status
bot.update_state(OnlineState.BUSY)

# Update bot name
bot.Info.update_name("New Name")

Event Handlers

Available event handlers:

  • LoginSuccess: Called when login is successful
  • LoginFailed: Called when login fails
  • Connected: Called when connected to server
  • Disconnected: Called when disconnected from server
  • GroupMessage: Called when a group message is received
  • PrivateMessage: Called when a private message is received
  • AdminAction: Called when an admin action occurs
  • UserUpdate: Called when a user update occurs
  • Log: Called for logging information

Requirements

  • Python 3.7+
  • python-socketio[client] >= 5.0.0
  • requests >= 2.25.0

License

MIT License

Credits

This library is a Python port of WOLFApi-TS by masamesa.

Disclaimer

This is an unofficial API and is not affiliated with WOLF or Palringo. Use at your own risk.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xwolfpython-1.0.0.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xwolfpython-1.0.0-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file xwolfpython-1.0.0.tar.gz.

File metadata

  • Download URL: xwolfpython-1.0.0.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for xwolfpython-1.0.0.tar.gz
Algorithm Hash digest
SHA256 cfad5e559af15e07a20b85fc64c7ec3673718dadc11f106cd7d230a7acf561c6
MD5 fffd3848ba2e0e9b38bcc44efbe0f629
BLAKE2b-256 0dc71f8ffa9454ba553737984ee85506cc9917115d06f292df5b5eb27ee5729a

See more details on using hashes here.

File details

Details for the file xwolfpython-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: xwolfpython-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 17.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for xwolfpython-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0e5d8df28aa017c1d16105a4a7c744a89b684d0d1231ee7a4efcd23597577f59
MD5 7bca623391d0372b88f25bd13d53fc4b
BLAKE2b-256 6554325afcf30c1ec4efb3d28cd6a7d879d39edd8bcc5ca7e204c67bf21a16e1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page