Closed jayKeegan closed 3 years ago
without a log as to what happened I would only be speculating. However I really haven't used this code since 2017 when I implemented it for https://github.com/popcorn9499/chatBot however youtube changed the api limits to something rather small making this entire program almost useless since it will hit the api limits in a few hours with 2 or so people chatting. maybe less maybe more depending on the amount of messages.
Your best bet would be to setup something like selenium to interact with the webpage for live chat directly and parse that to pull it to discord and vis versa. however I'm sure that would break some tos somewhere.
Anyways I can give a look at what's wrong if you send me the output from the program instead of just the code. otherwise its all speculation
Here is the console output:
liveID KicKGFVDakNCejNKSy16bm1nbmVHcUhaNmk1ZxILTlFVWjVPR1Y3dzQ
Logged in as
Rocket Launches Today#3997
789632676926717962
I see nothing in that log that indicates that it even noticed a message at all let alone tried to mirror it to the other service. try to send a message on both youtube and discord if you haven't already. you must do it when the application is running. Any please give youtube a good 5-30 seconds to propagate to discord as you have to hit the api manually and each request takes some of your google api quota which is in very short supply. if you have tried this I really don't know what is wrong.
There was an active conversation in the YouTube chat at the time, therefor messages should have been coming through. Are there any more logs available to figure out what's going on?
one thing I just realized might explain at least some of it. could you send me a copy of the config.json I don't need the discordToken or anything confidential but I do need to see the rest of it.
otherwise its possible the discord api changed as well since I wrote this bot and that is possibly to blame for it not even detecting messages from discord. But honestly its possibly configuration error. However since I havent used this code really since 2017 I am not really sure. Chatbot was sorta the better spinoff to this so it may be in your best interest to setup that
{"channelName": "\ud83d\udcac-general", "pageToken": "", "serverName": "Jay's test server", "discordToken": "TOKEN REMOVED", "discordToYoutubeFormating": "\"{0} - {1}\"", "youtubeToDiscordFormatting": "\"{0} - {1}\"", "youtubeToDiscord": true, "discordToYoutube": false}````
I am assuming you already know but you need discordToYoutube set to true to allow discord to youtube communication. However you could try enabling it and seeing how that works. It is also possible the what I believe is unicode in the channel name is causing issues with the bot. I am not sure if either of those is the case but if you could try stuff in this order.
Try setting discordToYoutube to true and sending a message in discord monitoring youtube chat to see if it appears. If it doesnt look in the bot console it should show something in the console. Please send me a copy of this log regardless at this step. if it doesnt work go onto attempt 2.
Now onto attempt 2. if it still isnt working then try making a channel without unicode or special characters. dashes should be fine and this will just indicate where the issue is specifically. If you could also send a copy of the console at this step I would greatly appreciate it.
Discord to YT error:
Ignoring exception in on_message Traceback (most recent call last): File "C:\Users\Jay\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 343, in _run_event await coro(*args, **kwargs) File "C:\Users\Jay\Documents\GitHub\sync-ytchat-to-discord\bot.py", line 259, in on_message await sendLiveChat(config["discordToYoutubeFormating"].format(message.author.display_name,message.content)) #prints this to the screen File "C:\Users\Jay\Documents\GitHub\sync-ytchat-to-discord\bot.py", line 186, in sendLiveChat list_chatmessages_inset.execute() File "C:\Users\Jay\AppData\Local\Programs\Python\Python39\lib\site-packages\googleapiclient\_helpers.py", line 134, in positional_wrapper return wrapped(*args, **kwargs) File "C:\Users\Jay\AppData\Local\Programs\Python\Python39\lib\site-packages\googleapiclient\http.py", line 935, in execute raise HttpError(resp, content, uri=self.uri) googleapiclient.errors.HttpError: <HttpError 403 when requesting https://youtube.googleapis.com/youtube/v3/liveChat/messages?part=snippet&alt=json returned "The specified live chat is no longer live.". Details: "[{'message': 'The specified live chat is no longer live.', 'domain': 'youtube.liveChat', 'reason': 'liveChatEnded'}]">
Looks like I got it working, thanks for your help!
Looks like I got it working, thanks for your help!
If you dont mind me asking. what was the solution?
Looks like I got it working, thanks for your help!
If you dont mind me asking. what was the solution?
Looks like the unicode character in the channel name was messing it up, I honestly have no idea how I fixed the discord to YT error haha
Looks like I got it working, thanks for your help!
If you dont mind me asking. what was the solution?
Looks like the unicode character in the channel name was messing it up, I honestly have no idea how I fixed the discord to YT error haha
ah ok thank you. The error you saw was something specific to the google/youtube api specifically
<HttpError 403 when requesting https://youtube.googleapis.com/youtube/v3/liveChat/messages?part=snippet&alt=json returned "The specified live chat is no longer live.". Details: "[{'message': 'The specified live chat is no longer live.', 'domain': 'youtube.liveChat', 'reason': 'liveChatEnded'}]">
Specifically something about Live chat has ended. Not sure what you did honestly to change that but hey Im glad its working.
Hey. I have set up the bot, and it comes online, etc, it isn't sending messages to the discord channel, any ideas why? It has full admin permissions. Thank you!
I have attached the python code below, since I have changed some stuff due to google API changes, and provided a stream ID.