Quickstart

This page gives a brief introduction to the library. It assumes you have the library installed, if you don’t check the Installing portion.

A Basic Antiland Bot

Let’s make a simple bot that listens for messages and prints when one has been detected.

It looks something like this:

import Antiland

session_token = ""
dialogue = ""
prefix = "!"

bot = Antiland.Bot(prefix, dialogue, session_token)

@bot.event
async def on_message(message):
    # Implement your event handling logic here
    print(f"Received message from {message.sender_name}: {message.text}")
    if str(message.text).startswith(f"{prefix}moo"):
        room= await bot.get_dialogue(dialogue,session_token)
        await room.send_message("test",session_token,room.objectId)

Let’s name this file antiland_bot_example.py. Make sure not to name it antiland.py as that’ll conflict with the library.

If this is your first time using the library this can be quite overwhelming so lets go step below.

  1. The first line just imports the library, if this raises a ModuleNotFoundError or ImportError then head on over to Installing section to make sure the library has been installed correctly

  2. We then use the Bot.command() decorator to register a command.

  3. Finally, we run the bot with our session token.

Now that we’ve made a bot, we have to run the bot. Since we are using python we can run the bot using one of the commands below.

On Windows:

$ py -3 example_bot.py

On other systems:

$ python3 example_bot.py

Now you can try playing around with your basic bot.