API Reference
This section provides documentation for various classes in the Antiland package.
Bot
- class Antiland.Bot(prefix, dialogue, session_token=None)[source]
The Bot class represents a bot on the Antiland platform.
- Parameters:
prefix (str) – The command prefix to trigger bot commands.
dialogue (str) – The ID of the dialogue associated with the bot.
session_token (str, optional) – The session token for authentication. Defaults to None.
- prefix
The command prefix to trigger bot commands.
- Type:
str
- running
A flag to indicate if the bot is running.
- Type:
bool
- session_token
The session token for authentication.
- Type:
str
- message_updater
An instance of the MessageUpdater class.
- Type:
MessageUpdater
- dialogue
The ID of the dialogue associated with the bot.
- Type:
str
- chats
A dictionary to store chat-related data.
- Type:
dict
- url
The URL for subscribing to chat updates.
- Type:
str
- async block_user(uuid, token)[source]
Block a user.
- Parameters:
uuid (str) – The UUID of the user to be blocked.
token (str) – The authentication token for the bot.
- async delete_contact(uuid, token)[source]
Delete a contact from the bot’s contact list.
- Parameters:
uuid (str) – The UUID of the contact to be deleted.
token (str) – The authentication token for the bot.
- event(func)[source]
Decorator to define custom event functions.
- Parameters:
func (function) – The event function to be registered.
- Returns:
The decorated event function.
- Return type:
function
- async exit_chat(token, dialogue)[source]
Exit a chat dialogue.
- Parameters:
token (str) – The authentication token for the bot.
dialogue (str) – The ID of the chat dialogue to exit.
- async get_contacts(token)[source]
Get the bot’s contacts.
- Parameters:
token (str) – The authentication token for the bot.
- Returns:
A list of User instances representing bot contacts.
- Return type:
list
- async get_dialogue(dialogue, token)[source]
Get information about a specific dialogue.
- Parameters:
dialogue (str) – The ID of the dialogue to retrieve information for.
token (str) – The authentication token for the bot.
- Returns:
A Dialogue instance representing the specified dialogue.
- Return type:
- async get_stats(session_token)[source]
Get account statistics.
- Parameters:
session_token (str) – The session token for authentication.
- Returns:
An Account instance containing account statistics.
- Return type:
- async get_topchats(token)[source]
Get the top chat dialogues.
- Parameters:
token (str) – The authentication token for the bot.
- Returns:
A list of Dialogue instances representing the top chat dialogues.
- Return type:
list
- async join_chat(token, dialogue)[source]
Join a chat dialogue.
- Parameters:
token (str) – The authentication token for the bot.
dialogue (str) – The ID of the chat dialogue to join.
- async on_message(sender, text)[source]
Process incoming messages and execute commands.
- Parameters:
sender (str) – The sender of the message.
text (str) – The text of the message.
- async send_gift(gift_type, reciever, dialogue, session_token)[source]
Send a gift
Parameters: gift_type (str): The type of gift to send e.g. rose. reciever (str): The recipient’s ID or username. dialogue (str): The ID of the dialogue or conversation related to the gift. session_token (str): A session token for authentication and authorization.
Example: result = await bot.send_gift(“rose”, “user123”, “dialogue456”, “your_session_token_here”) print(result)
- async translate(token, message, message_id)[source]
Translate a message.
- Parameters:
token (str) – The authentication token for the bot.
message (str) – The message to be translated.
message_id (str) – The message ID.
- Returns:
The translated message.
- Return type:
str
User
- class Antiland.user.User(data)[source]
The user class represents a User profile on the Antiland platform.
- get_formatted_datetime(self, date_str)[source]
Essentially the same as get_time but extracts from a certain json structure for getting certain times
- get_formatted_date(self, date_str)[source]
Essentially the same as get_date but extracts from a certain json structure for getting certain dates
- property about_me
Users About Me
- property accessories
List of the integer values of what Accessories the user has
- property age
Users age
- property anti_karma
Users AntiKarma amount
- property avatar
Users avatar number
- property blessed
Boolean for if user is blessed or not
- property blocked_by
List of UUIDS who have blocked the user
- property created_at
Users account creation date and time in iso format
- property created_at_date
Users account creation date formatted from created_at
- property created_at_time
Users account creation time formatted from created_at
- property female
Boolean for if user is female or not
- property is_admin
Boolean for if user is Admin or not
- property is_vip
Boolean for if user is VIP or not
- property min_karma
Minimum Karma required to message the user
- property object_id
Users UUID
Users premium avatar number if applicable
- property prison_exp_date
Users prison expiration date and time in iso format
- property prison_exp_date_date
Users prison expiration date formatted from prison_exp_date
- property prison_exp_time
Users prison expiration time formatted from prison_exp_date
- property profile_name
Users profile name
- property rating
Users Karma amount
- property show_online
Boolean for if user shows as online or not
- property updated_at
“Users account creation date and time in iso format
- property vip_exp_date
Users VIP expiration date and time in iso format
- property vip_exp_date_date
Users VIP expiration date formatted from prison_exp_date
- property vip_exp_time
Users VIP expiration time formatted from prison_exp_date
Dialogue
- class Antiland.dialogue.Dialogue(data)[source]
Represents a dialogue or chat conversation within the Antiland application.
- lang
The language of the dialogue.
- Type:
str
- groupAdmins
List of group administrators’ data.
- Type:
list
- lastmessage
The last message in the dialogue.
- Type:
str
- objectId
The unique identifier for the dialogue.
- Type:
str
- guestname
The guest’s name in the dialogue.
- Type:
str
- foundername
The founder’s name.
- Type:
str
- founderId
The unique identifier of the founder.
- Type:
str
- private
Indicates if the dialogue is private.
- Type:
bool
- public
Indicates if the dialogue is public.
- Type:
bool
- humanLink
A human-readable link associated with the dialogue.
- Type:
str
- accepted
Indicates if the dialogue has been accepted.
- Type:
bool
- flags
Flags associated with the dialogue.
- Type:
str
- like_message(messageid, senderid, token, dialogue)[source]
Like a specific message in the dialogue.
- Parameters:
data (dict) – A dictionary containing dialogue-related data.
Note
The methods in this class use asynchronous I/O operations and should be awaited.
Message
- class Antiland.message.Message(data)[source]
Represents a message in the Antiland platform.
- Parameters:
data (dict) – The message data.
- _data
The raw data of the message.
- Type:
dict
- Properties:
id (str): The ID of the message. text (str): The content of the message. sender_id (str): The ID of the message sender. dialogue_id (str): The ID of the dialogue associated with the message.
Example
>>> message_data = { ... "objectId": "123456", ... "message": "Hello, world!", ... "senderId": "user123", ... "dialogue": "dialogue789" ... } >>> message = Message(message_data) >>> message.id '123456' >>> message.text 'Hello, world!' >>> message.sender_id 'user123' >>> message.dialogue_id 'dialogue789'
- property dialogue_id
- property id
- property sender_id
- property text
Account
- class Antiland.account.Account(data)[source]
- property ACL
The Access Control List associated with the account.
- property acceptRandoms
Indicates whether the user accepts random connections.
- property age
The user’s age.
- property antiKarma
The user’s anti-karma value.
- property artifacts
A list of user artifacts.
- property authData
User authentication data.
- property avatar
The URL of the user’s avatar.
- property blockedBy
A list of users who have blocked the account.
- property className
The class name of the account data.
- property color
The user’s chosen color.
- property country
The user’s country.
- property createdAt
The timestamp when the account was created.
- property dOk
Indicates whether the user has enabled D-OK.
- property email
The user’s email address.
- property emailIsValid
Indicates whether the user’s email is valid.
- property emailIsVerified
Indicates whether the user’s email address is verified.
- property female
Indicates the user’s gender (female or not).
- property lang
The user’s preferred language.
- property lastAction
The timestamp of the user’s last action.
- property lastChangeDate
The timestamp of the last change to the user’s account.
- property lastOpen
The timestamp of the last account activity.
- property likesFemale
Indicates whether the user likes females.
- property likesMale
Indicates whether the user likes males.
- property minKarma
The minimum required karma value.
- property more
Additional user information.
- property msgCount
The total count of messages sent by the user.
- property objectId
The unique identifier for the account.
- property profileName
The user’s profile name.
- property pvtChannelId
The private channel ID.
- property pvtcCount
The total count of private chats the user has participated in.
- property quest
The user’s quest information.
- property rating
The user’s rating on the platform.
- property search
The user’s search preferences.
- property totalBans
The total count of bans applied to the user.
- property updatedAt
The timestamp when the account was last updated.
- property userLangs
A list of languages preferred by the user.
- property username
The username associated with the account.