Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi all,

I recently entered in a community that want to create a Telegram bot that needs to integrate with Twitch and Patreon subscribers. The bot is already created and working, hosted to Heroku. We used this Soatok/headless-lounge-bot to setup our bot.
What it does? It checks when a user is trying to enter into a telegram chat and if the user has an active subscription to a Twitch channel or to a Patreon (or both, depends on how you create the chat) then it allow/deny access to the chat. This works without any problem, but we want also to create a command and a scheduled event that checks inside the chat which users have expired subscriptions and then kick them. The project I linked uses Slim framework which is not known to any of us, and here the problems begin. How can we reach our purpose? Is somebody so kind to help us?

What I have tried:

I already tried to add a new command to the Telegram class, that is dedicated to manage all the events concerned Telegram. The command I added prints how many subscribers has the Twitch channel using the Twitch object created inside the Telegram constructor, but I always had an empty Twitch object (the Twitch object is used to communicate with Twitch API's) so it doesn't work. I can't figure it out how to create the Twitch object correctly to use it to get the info that I want. Also I don't understand where the Telegram class is created, I suppose Slim does it but I don't know in which part of the code. I also tried with Patreon but the result is the same, empty object.
Posted
Updated 6-Jun-20 0:51am
v4
Comments
Richard MacCutchan 6-Jun-20 5:01am    
Sorry, but no one here can guess what your code is doing. Please provide proper details and explain where the failures are happening.
Needle_Ago 6-Jun-20 5:18am    
I try to go more in-depth. There is a class named Telegram which is dedicated to manage all the telegram events in a chat. Inside this class is used a Trait hooked to new message events (is named NewMessageTrait). The Telegram class has a constructor that, among the other things, populate 2 properties named Twitch and Patreon. This 2 properties are created like an object, the objects are defined inside Twitch class and Patreon class. My problem is that when i tried to use this properties inside the Telegram class they are empty, so I can't use their methods correctly.
Due to the fact that I don't know how Slim framework works, I can't understand when and where Telegram class is created and why I get this 2 objects always empty.

I hope I have been as clear as possible.
Richard MacCutchan 6-Jun-20 5:40am    
Sorry, but we have no idea what the Telegram class is or what it does. Have you checked its documentation to see that you are using the correct method calls? Have you used your debugger to trace what happens when your code runs?
Needle_Ago 6-Jun-20 5:52am    
I provided the link of the repo in my question, you can see on github what the Telegram class does, it is located in src/HeadlessLoungeBot.
Unfortunetely the documentation is very poor, and yes I use the debugger to trace the behaviour of the code but I don't know how Slim framework works after the $app->run(); command so debugging is not so easy for me.
Richard MacCutchan 6-Jun-20 6:11am    
Sorry, if you cannot show the code that is causing the problem, and explain exactly what is happening, there is not much we can do to help you.

1 solution

Talk to the people who created it: If necessary raise an issue on the project: Issues · soatok/headless-lounge-bot · GitHub[^] as either the project of it's documentation needs revising.

We can't help you with this: it needs in depth knowledge of a github project that maybe 100 people have used or tried to use. Finding one of them with sufficient depth out of a population of 14,000,000 on this site is very unlikely.
So, talk to the people who wrote it - theuy will know it better than anyone here.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900