big debug amélioration enregistrement
This commit is contained in:
@@ -3,14 +3,14 @@ import argparse
|
||||
from urllib.parse import urlparse
|
||||
from pytmi import Client # Assurez-vous que c'est le nom correct de votre module et qu'il est correctement installé.
|
||||
|
||||
async def send_message_to_twitch_stream(nick, token, stream_url, message):
|
||||
async def send_message_to_twitch_stream(pseudo, token, stream_url, message):
|
||||
parsed_url = urlparse(stream_url)
|
||||
channel = parsed_url.path.lstrip('/')
|
||||
|
||||
async with Client() as client:
|
||||
try:
|
||||
print("Tentative de login")
|
||||
await client.login_oauth(token, nick)
|
||||
await client.login_oauth(token, pseudo)
|
||||
print("Tentative de join")
|
||||
await client.join(channel)
|
||||
print("Tentative d'envoi de message")
|
||||
@@ -21,12 +21,7 @@ async def send_message_to_twitch_stream(nick, token, stream_url, message):
|
||||
except Exception as e:
|
||||
print(f"Erreur lors de l'interaction avec Twitch: {type(e).__name__}, {e}")
|
||||
|
||||
async def main():
|
||||
# nick = "foufure13" # Remplacez par votre pseudo Twitch
|
||||
# token = "oauth:7mexqe9zcxrqpz1s0fji4oolr4mxn6" # Remplacez par votre token OAuth
|
||||
# stream_url = "https://www.twitch.tv/shambiess" # Remplacez par l'URL du stream Twitch
|
||||
# message = "yoo" # Message à envoyer
|
||||
|
||||
async def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('-pseudo', type=str, required=True, help='Pseudo name account')
|
||||
parser.add_argument('-token', type=str, required=True, help='Token oauth')
|
||||
@@ -35,7 +30,8 @@ async def main():
|
||||
args = parser.parse_args()
|
||||
|
||||
stream_url = "https://www.twitch.tv/"+args.twitchname
|
||||
await send_message_to_twitch_stream(nick=args.pseudo, token=args.token, stream_url=stream_url, message=args.message)
|
||||
await send_message_to_twitch_stream(pseudo=args.pseudo, token=args.token, stream_url=stream_url, message=args.message)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
|
||||
Reference in New Issue
Block a user