Optimized code with maximum efficiency and minimal resource usage |
Seamless backward compatibility with existing Amino bot projects |
Advanced command system with extensive API coverage |
Works on iPhones without jailbreak or restrictions |
Built-in error handling and connection management |
Easy customization for any bot requirements |
pip install amino.light.py
from AminoLightPy import Client, SubClient, ChatEvent
# Initialize and login
client = Client()
client.login("[email protected]", "your_password")
@client.event(ChatEvent.TEXT_MESSAGE)
def on_message(data):
if data.message.content.startswith('/hello'):
sub_client = SubClient(comId=data.comId, profile=client.profile)
sub_client.send_message(
chatId=data.message.chatId,
message="๐ Hello! I'm your new Amino bot!"
)
๐ Client - Main Connection Handler
The Client
class manages your connection to Amino services and handles global operations.
from AminoLightPy import Client
# Basic setup
client = Client()
# Advanced configuration
client = Client(
deviceId="your_device_id",
socket_enabled=True, # Enable real-time events
proxies={"http": "http://proxy.example.com"}
)
# Universal login (recommended)
client.login("[email protected]", "password123")
# Specific methods
client.login_email("[email protected]", "password123")
client.login_phone("+1234567890", "password123")
client.login_sid("your_session_id") # Use cached session
@client.event(ChatEvent.TEXT_MESSAGE)
def handle_text(data):
print(f"๐ Message: {data.message.content}")
@client.event(ChatEvent.IMAGE_MESSAGE)
def handle_image(data):
print(f"๐ผ๏ธ Image from: {data.message.author.nickname}")
@client.event(ChatEvent.VOICE_MESSAGE)
def handle_voice(data):
print(f"๐ต Voice message received!")
๐ฏ Available Events
Event | Trigger |
---|---|
on_text_message |
Text messages |
on_image_message |
Image uploads |
on_voice_message |
Voice messages |
on_youtube_message |
YouTube links |
on_sticker_message |
Stickers |
on_join_chat |
User joins chat |
on_leave_chat |
User leaves chat |
๐ SubClient - Community Operations
The SubClient
handles all community-specific actions and messaging.
sub_client = SubClient(comId=123456, profile=client.profile)
# Send text message
sub_client.send_message(chatId="chat_id", message="Hello World! ๐")
# Send image with caption
with open("image.jpg", "rb") as img:
sub_client.send_message(
chatId="chat_id",
message="Check this out! ๐ธ",
file=img
)
# Mention users
sub_client.send_message(
chatId="chat_id",
message="Hey @user, look at this! ๐",
mentionUserIds=["user_id_here"]
)
# Embed links with preview
from base64 import b64encode
with open("preview.jpg", "rb") as preview:
sub_client.send_message(
chatId="chat_id",
message="Amazing content! โจ",
linkSnippet=[{
"link": "https://example.com",
"mediaType": 100,
"mediaUploadValue": b64encode(preview.read()).decode(),
"mediaUploadValueContentType": "image/jpeg"
}]
)
# Create blog post
sub_client.post_blog(
title="๐ My Amazing Blog Post",
content="This is where I share my thoughts...",
imageList=[open("img1.png", "rb"), open("img2.png", "rb")]
)
# Create wiki entry
sub_client.post_wiki(
title="๐ Helpful Wiki",
content="Everything you need to know about...",
icon=open("wiki_icon.png", "rb")
)
# Show typing indicator
with sub_client.typing(chatId="chat_id"):
# Simulate thinking time
time.sleep(2)
sub_client.send_message(chatId="chat_id", message="Done thinking! ๐ญ")
# Show recording indicator
with sub_client.recording(chatId="chat_id"):
time.sleep(3) # Prepare voice message
with open("voice.mp3", "rb") as voice:
sub_client.send_message(
chatId="chat_id",
file=voice,
fileType="audio"
)
๐ Moderation Tools (Staff Only)
Advanced moderation features for community leaders and staff.
# Content moderation
sub_client.hide(blogId="blog_id", reason="Inappropriate content")
sub_client.feature(time=3, blogId="blog_id") # Feature for 3 hours
sub_client.unfeature(blogId="blog_id")
# User management
sub_client.ban(userId="user_id", reason="Spam violation")
sub_client.unban(userId="user_id", reason="Appeal approved")
sub_client.strike(
userId="user_id",
time=24,
title="Community Guidelines",
reason="Inappropriate behavior"
)
sub_client.warn(userId="user_id", reason="Minor rule violation")
๐ฎ Command Bot
from AminoLightPy import Client, SubClient
import random
client = Client()
client.login("email", "password")
commands = {
'/help': '๐ Available commands:\n/dice - Roll a dice\n/joke - Get a random joke',
'/dice': lambda: f'๐ฒ You rolled: {random.randint(1, 6)}!',
'/joke': lambda: random.choice([
"Why do programmers prefer dark mode? Because light attracts bugs! ๐",
"How many programmers does it take to change a light bulb? None, that's a hardware problem! ๐ก"
])
}
@client.event(ChatEvent.TEXT_MESSAGE)
def handle_command(data):
message = data.message.content.lower()
if message in commands:
sub_client = SubClient(comId=data.comId, profile=client.profile)
response = commands[message]
if callable(response):
response = response()
sub_client.send_message(
chatId=data.message.chatId,
message=response
)
๐จ Welcome Bot
@client.event(ChatEvent.USER_JOINED)
def welcome_user(data):
sub_client = SubClient(comId=data.comId, profile=client.profile)
welcome_message = f"""
๐ Welcome to our community, {data.message.author.nickname}!
๐ Please read our guidelines
๐ฌ Feel free to introduce yourself
๐ค Have fun and be respectful!
"""
sub_client.send_message(
chatId=data.message.chatId,
message=welcome_message
)
๐ Auto-Responder
auto_responses = {
'hello': '๐ Hello there! How can I help you today?',
'bye': '๐ Goodbye! Have a great day!',
'thanks': '๐ You\'re welcome! Happy to help!',
}
@client.event(ChatEvent.TEXT_MESSAGE)
def auto_respond(data):
message = data.message.content.lower()
for keyword, response in auto_responses.items():
if keyword in message:
sub_client = SubClient(comId=data.comId, profile=client.profile)
sub_client.send_message(
chatId=data.message.chatId,
message=response
)
break
๐ฌ Telegram
|
๐ Discord
|
๐ Documentation
|
We welcome contributions! Whether it's:
- ๐ Bug reports
- โจ Feature requests
- ๐ Documentation improvements
- ๐ง Code contributions
This project is licensed under the MIT License - see the LICENSE file for details.