Skip to main content

A Python wrapper for the Nertivia API

Project description

A Python wrapper for the Nertivia API

Install

pip install nertivia4py

Examples

Basic example for just controlling the API step by step.

import nertivia4py

channel_id = 123
token = "TOKEN_HERE"

bot = nertivia4py.Nertivia(token)
channel = bot.getChannel(channel_id)

channel.send("Hello World!")

Basic example for connecting to the gateway.

import nertivia4py

token = "TOKEN_HERE"
prefix = "."

bot = nertivia4py.gateway.Client(prefix)

@bot.event
def on_connect(event):
    print("Connected!")

@bot.event
def on_message(event):
    message = nertivia4py.Message(event["message"]["messageID"], event["message"]["channelID"])
    print(message.content)

    if message.content.startswith(prefix):
        command = message.content.split(" ")[0][1:]

        if command == "ping":
            message.reply("pong!")

bot.run(token)

For more examples, take a look at the examples folder in the github repo.

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

nertivia4py-0.3.tar.gz (6.9 kB view hashes)

Uploaded Source

Supported by

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