dougdouggithub / twitchplays Goto Github PK
View Code? Open in Web Editor NEWCode that allows Twitch Chat or Youtube Chat to control a game
License: MIT License
Code that allows Twitch Chat or Youtube Chat to control a game
License: MIT License
Doug come on, you can write better code. We believe in you
Currently Twitch handles repeating commands like this:
to omit this I changed the code in TwitchPlays_TEMPLATE.py (line 62) so the msg variable works anyways:
def handle_message(message):
try:
msg = message['message'].lower()
chat_cmd = msg.split(" ")
if len(chat_cmd) > 1 and isinstance(chat_cmd[1], str) and len(chat_cmd[1]) > 1 and chat_cmd[1] not in ['right', 'up']:
print('ignore sentence')
else:
msg = chat_cmd[0]
Logic is:
if the command has multiple parts like "down [?]", split the string at the space and if the second part has only 1 character (like a "?") set msg = the first part before the space, so it counts as a valid command.
Additionally check if the second part after the space is longer than 1 character (could be a sentence in chat starting with a command word) ignore that by keeping the msg as is.
Hi, I'm running the program, it reads the messages but the keys seem to be wrong. If the chat messages is "left" the program will give me "a" as a keystroke, if the message is "right" it gives me "d"...
These are the only keystrokes I've found so far, with trial and error. What am I doing wrong? I haven't modified any of the files apart from the template one.
Does it have to do with the fact that I have an italian keyboard?
Before you had a github for this, I downloaded it and put some work into making it more user friendly
I see you have updated some of the connection stuff and your template(TwitchPlays.py in my repo)
Here's a link to what I did early this year
https://github.com/jfp1992/Twitch_Plays
keys_dictionary.py - a hash map for pulling the key codes
keys_base_class.py - contains a class with some methods to make key actions easy to code
https://github.com/jfp1992/Twitch_Plays/blob/main/mouse_base_class.py - contains a class with some methods to make mouse actions easy to code
I'd love to keep working on my additions(especially now that I have a ton more experience), but it doesn't feel right doing so, now that you have yours on github.
A few options
We could collaborate
I can delete my repo
Leave both as is
Thoughts?
I know you added in the README.md
that You are welcome to use or adapt this code for your own content.
but no LICENSE
file.
If there is a LICENSE
file it would explain in more detail on what you can do with your source code.
i am confused on how i can use this software in arch linux
Traceback (most recent call last):
File "/home/restruct/TwitchPlays/TwitchPlays_TEMPLATE.py", line 4, in
import pydirectinput
File "/home/restruct/TwitchPlays/tp/lib/python3.11/site-packages/pydirectinput/init.py", line 6, in
SendInput = ctypes.windll.user32.SendInput
^^^^^^^^^^^^^
AttributeError: module 'ctypes' has no attribute 'windll'
here is the error that i got when i tried to run it
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.