I have been using the twitch and discord-rewrite api
I have been writing a program where a user in discord can type !Notify (twitch-client-id) which will notify them on discord when one of the people they have followed on twitch has started streaming. The problem I have is that I don't know how I could get the bot to say "name has started streaming" in the channel that the person typed "Notify in. I have got to the point where I have done all the logic for finding when someone is streaming, I just don't know how to print it out
I have tried making a function like:
@client.event async def send(msg): await client.send_message(msg)
and then calling it directly and putting the msg in but that doesn't work
def relay_detection(self):
while True:
time.sleep(5)
if self.api_request == True:
online = self.new_twitch_streams
offline = self.offline_twitch_streams
print("Checking")
if online != []:
for x in range(len(online)):
self.prev_twitch_streams.append(online[x])
print(f"{online[x]} has gone live on Twitch!")
if offline != []:
for x in range(len(offline)):
self.prev_twitch_streams.remove(offline[x])
print(f"{offline[x]} has gone offline on Twitch!")
self.api_request = False
Let me explain. "online" is a list with all the streamers that are currently streaming and "offline" is a list of all the streamers that just went offline. As you can see I have printed "name has gone live on twitch" and "name has gone offline on twitch" when I detect that someone has started streaming or has stopped streaming. So I need to create a function with the discord-rewrite api to do that.
So, to summarise, I need a function where my bot can print out a msg when I call it. I would like to use the discord-rewrite api, this may have been asked by I just cant find it.