Skip to main content

An easy way to listen for Trakteer donation in Python

Project description

⚠️ NOTE: THIS PROJECT IS ONLY FOR EDUCATIONAL PURPOSE!! ⚠️
I WONT RESPONSIBLE FOR SOMETHING HAPPEN WHEN USING THIS PROGRAM!!

Trakteer Donate

An easy way to listen for Trakteer donation in Python

Installation

To install this package, you can easily use pip!

pip install trakteerdonate

Or,

pip install git+https://github.com/then77/trakteerdonate

Package Usage

  1. First open your Trakteer and go to Stream Overlay (here)
  2. On the Widget URL, copy the key, and the hash
  3. Create a code and import the Client function.
from trakteerdonate import Client
client = Client("hash", "streamKey")
# Replace "hash" and "streamKey" with the key you copied before
  1. Add listener for donation
@client.event
async def on_donation(ws, data):
    print("Received donation:")
    print(f"  - Name: {data.name}")
    print(f"  - Amount: {data.amount}")
    print(f"  - Message: {data.message}")
  1. Last, add this code To the bottom of the code and run!
client.start()

The reason it should be placed on the bottom because its a blocking function.

Example Code

from trakteerdonate import Client

client = Client("hash", "streamKey")

@client.event
async def on_connect(ws):
    print("Connected to Trakteer!")

@client.event
async def on_donation(ws, data):
    print("Received donation:")
    print(f"  - Name: {data.name}")
    print(f"  - Amount: {data.amount}")
    print(f"  - Message: {data.message}")

client.start()

Repository License

This repository and its code is under the MIT License. Read more here.

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

trakteerdonate-1.0a2.tar.gz (6.0 kB view details)

Uploaded Source

File details

Details for the file trakteerdonate-1.0a2.tar.gz.

File metadata

  • Download URL: trakteerdonate-1.0a2.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.4

File hashes

Hashes for trakteerdonate-1.0a2.tar.gz
Algorithm Hash digest
SHA256 e8e13e0a269e085722976d5b42e13e0644324ef7381f7063bff089973ed5b451
MD5 35fa413bb9a70529e4c431413c3566b8
BLAKE2b-256 d9c8bc117232d4de022aaee1448866f2fabd3b30dc7cac73a368f41817cd3eaa

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