python 抽搐聊天输入

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 抽搐聊天输入相关的知识,希望对你有一定的参考价值。

#Define the imports
import twitch
import keypresser
t = twitch.Twitch();
k = keypresser.Keypresser();

#Enter your twitch username and oauth-key below, and the app connects to twitch with the details.
#Your oauth-key can be generated at http://twitchapps.com/tmi/
username = "smiles_for_free";
key = "oauth:irhtkk9373gcl8p86pnsrqwwxva1ix";
t.twitch_connect(username, key);

#The main loop
while True:
    #Check for new mesasages
    new_messages = t.twitch_recieve_messages();

    if not new_messages:
        #No new messages...
        continue
    else:
        for message in new_messages:
            #Wuhu we got a message. Let's extract some details from it
            msg = message['message'].lower()
            username = message['username'].lower()
            print(username + ": " + msg);

            #This is where you change the keys that shall be pressed and listened to.
            #The code below will simulate the key q if "q" is typed into twitch by someone
            #.. the same thing with "w"
            #Change this to make Twitch fit to your game!
            if msg == "q": 
                k.key_press("q");
                print("q pressed!");
            if msg == "w": 
                k.key_press("w");
                print("w pressed!");
            

以上是关于python 抽搐聊天输入的主要内容,如果未能解决你的问题,请参考以下文章

python 抽搐聊天输入

python 抽搐

如何防止机器人发送垃圾邮件? |抽搐.py |不和谐.py

Gtk3和开罗动画抽搐

带卷曲的后抽搐

python恢复微信聊天记录