Skip to main content

An unofficial Python API for WOLF (AKA Palringo) - Python port of wolf.js

Project description

xwolfx

An unofficial Python API for WOLF (AKA Palringo) - Python port of wolf.js

PyPI version Python Version License: MIT

التثبيت | Installation

pip install xwolfx

الاستخدام السريع | Quick Start

مثال بسيط | Basic Example

import asyncio
from xwolfx import WOLF

async def main():
    client = WOLF()
    
    @client.on('ready')
    def on_ready():
        print('🤖 Bot is ready!')
    
    @client.on('channel_message')
    async def on_channel_message(message):
        if message.body == '!ping':
            await message.reply('Pong!')
        elif message.body == '!hello':
            await message.reply('مرحباً! Hello from xwolfx Python bot!')
    
    @client.on('private_message')
    async def on_private_message(message):
        await message.reply('Thanks for the private message!')
    
    # تسجيل الدخول | Login
    await client.login('your_email@example.com', 'your_password')
    
    # إبقاء البوت يعمل | Keep bot running
    await asyncio.sleep(3600)  # Run for 1 hour

if __name__ == "__main__":
    asyncio.run(main())

نظام الأوامر | Command System

from xwolfx import WOLF, Command

client = WOLF()

# إنشاء أوامر مخصصة | Create custom commands
def help_command(context):
    help_text = """
    🤖 Available Commands:
    !help - Show this help message
    !ping - Test command
    !info - Bot information
    """
    return context.reply(help_text)

def info_command(context):
    return context.reply("🐍 Python WOLF Bot using xwolfx library!")

# تسجيل الأوامر | Register commands
client.command_handler.register([
    Command('bot_command_help', {'both': help_command}),
    Command('bot_command_info', {'both': info_command})
])

إعدادات متقدمة | Advanced Configuration

from xwolfx import WOLF
from xwolfx.constants import OnlineState, LoginType

client = WOLF()

# تخصيص الإعدادات | Custom configuration
client.config['keyword'] = 'mybot'
client.config['framework']['login']['onlineState'] = OnlineState.ONLINE

# تسجيل دخول متقدم | Advanced login
await client.login(
    email='bot@example.com',
    password='secure_password',
    online_state=OnlineState.ONLINE,
    login_type=LoginType.EMAIL
)

المميزات | Features

  • 🔌 اتصال بمنصة WOLF للدردشة | Connect to WOLF chat platform
  • 💬 إرسال واستقبال الرسائل | Send and receive messages
  • 🎮 نظام معالجة الأوامر | Command handling system
  • 📡 معمارية قائمة على الأحداث | Event-driven architecture
  • 🌍 دعم متعدد اللغات | Multi-language support
  • 👥 رسائل القنوات والخاصة | Channel and private messaging
  • 🔧 سهل الاستخدام والتخصيص | Easy to use and customize

الثوابت المتاحة | Available Constants

حالات الاتصال | Online States

from xwolfx.constants import OnlineState

OnlineState.OFFLINE    # غير متصل | Offline
OnlineState.ONLINE     # متصل | Online  
OnlineState.AWAY       # بعيد | Away
OnlineState.BUSY       # مشغول | Busy
OnlineState.INVISIBLE  # مخفي | Invisible

أنواع تسجيل الدخول | Login Types

from xwolfx.constants import LoginType

LoginType.EMAIL     # البريد الإلكتروني | Email
LoginType.GOOGLE    # جوجل | Google
LoginType.FACEBOOK  # فيسبوك | Facebook
LoginType.APPLE     # أبل | Apple

أمثلة متقدمة | Advanced Examples

بوت ذكي للردود التلقائية | Smart Auto-Reply Bot

import asyncio
from xwolfx import WOLF

async def smart_bot():
    client = WOLF()
    
    # قاموس الردود الذكية | Smart replies dictionary
    responses = {
        'hello': 'مرحباً! كيف يمكنني مساعدتك؟',
        'help': 'أنا بوت Python مصنوع بـ xwolfx!',
        'time': lambda: f'الوقت الحالي: {datetime.now()}',
        'ping': 'Pong! 🏓'
    }
    
    @client.on('channel_message')
    async def smart_reply(message):
        text = message.body.lower()
        for keyword, response in responses.items():
            if keyword in text:
                reply = response() if callable(response) else response
                await message.reply(reply)
                break
    
    await client.login()

asyncio.run(smart_bot())

اختبار المكتبة | Testing the Library

cd xwolfx
python test_xwolfx.py

المساهمة | Contributing

نرحب بالمساهمات! يرجى إنشاء Pull Request أو Issue على GitHub.

الرخصة | License

MIT License - منقول من مكتبة wolf.js الأصلية

روابط مفيدة | Useful Links

الدعم | Support

للحصول على الدعم، يرجى إنشاء Issue على GitHub أو الانضمام إلى مجتمع WOLF.

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

xwolfx-1.0.1.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

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

xwolfx-1.0.1-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file xwolfx-1.0.1.tar.gz.

File metadata

  • Download URL: xwolfx-1.0.1.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for xwolfx-1.0.1.tar.gz
Algorithm Hash digest
SHA256 627e058f31eb8e712b6c789e47f2281dd3f393fcff4b8de8606737d2e0e46793
MD5 45eea9e9346962e7094d7cc38cb53d63
BLAKE2b-256 e7e2af64d0a9d27aaaa9267433dcd06dfe3bca733923c130fed1cf421eb904f7

See more details on using hashes here.

File details

Details for the file xwolfx-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: xwolfx-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for xwolfx-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fae20ec9549df877652aa6cf90da800170a7b77823f8456673215213d68602d0
MD5 f433a162c9ff0be45a2ec3bd3ba1aab3
BLAKE2b-256 206a7140377767d2eeb501d658476654d2c7d639cc0b9eab5dd57a823c5a3b2a

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