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.0a1.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

trakteerdonate-1.0a1-py3.10.egg (2.0 kB view details)

Uploaded Egg

File details

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

File metadata

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

File hashes

Hashes for trakteerdonate-1.0a1.tar.gz
Algorithm Hash digest
SHA256 80f38863ddfe218fce05502d1e31ed75ae827fa9610d0ae10697c49734fa09bb
MD5 546f76a24267aea73ce703607767bc17
BLAKE2b-256 67e27710026e654a5ab9286e8a8fd6f7b595e85e0193e80a05883b2a9948021b

See more details on using hashes here.

File details

Details for the file trakteerdonate-1.0a1-py3.10.egg.

File metadata

  • Download URL: trakteerdonate-1.0a1-py3.10.egg
  • Upload date:
  • Size: 2.0 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.4

File hashes

Hashes for trakteerdonate-1.0a1-py3.10.egg
Algorithm Hash digest
SHA256 396338703e370951c5eb187dca7d594fd0163242f7e59677501ca9280c1883d5
MD5 cffa2095a57cb4e0dcc10f61b2ef9dbd
BLAKE2b-256 2d1b55d57034641474fad135ba2bf17ca5ee51beebef203d187f10aefb499ba4

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