Skip to content

then77/trakteerdonate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚠️ Note: This Library Seems Will Not Work For Now ⚠️
Since They Change The Way This Program Listen For Donation.
Want to help me? Sure i appreciate!

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()

More Info For API

Wait, do you have another API to interact instead of only listening donation?

Currenly no since i dont have much time to do that. But, i found another cool project that can do something like that here. Even though it uses Javascript, its still awesome.

Known Issue

Since this package use websocket to communicate, some host like Replit may not allow this protocol. But, you still can run on your local pc or another host that support it, or you can use alternative library i mentioned above since it doesn't use websocket thing.

Repository License

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

About

An easy way to listen for Trakteer donation.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages