Amethyst93 / Discord-YouTube-Notifier

A small, easy to use Discord bot that displays live video updates of a YouTube channel on Discord.
MIT License
47 stars 28 forks source link

Bot is not 'PUSHING UPDATE ON DISCORD' #6

Open samsunix opened 3 years ago

samsunix commented 3 years ago

Trying to run this on Raspberry Pi Followed instructions launching with command 'python3 main.py' Bot is not posting

pi@pi:~/pipy_bot $ python3 main.py Logged in as: SamBot 768508391777107979

---------------------------------------

Bot running. Checking for new videos from <@samuli.pl> <@samuli.pl> IS LIVESTREAMING NOW! PUSHING UPDATE ON DISCORD. Rechecking in 04:57

samsunix commented 3 years ago

fixed YAMLoadWarning by changing config.py line 14

cfg = yaml.load(ymlfile) to cfg = yaml.load(ymlfile, Loader=yaml.FullLoader)

bobwww commented 3 years ago

Hello, I have the same problem. After a quick examination, I believe the problem is that the code was made for an older version of discord.py.

You can try to install an older version, or use my solution:

Change line 46 from: await client.send_message(client.get_channel(str(config.getDiscordChannelList()[x]['channelID'])), newvideo) to: await client.get_channel(int(config.getDiscordChannelList()[x]['channelID'])).send(newvideo) The same with line 54 from: await client.send_message(client.get_channel(str(config.getDiscordChannelList()[x]['channelID'])), livestream) to: await client.get_channel(int(config.getDiscordChannelList()[x]['channelID'])).send(livestream)

To explain:

client is of type discord.Client(), in the rewritten discord.py, it no longer has the send_message method. So what I do, is first get the channel, then use its send method, to send the message. Also, notice that the get_channel method requires an int, not an str as in the original code.

I hope I helped and explained well enough, as I am no expert.