hzoo / twitchplaysx Goto Github PK
View Code? Open in Web Editor NEW:video_game: Connect to IRC to send inputs to any program, Twitch Plays Pokemon style. (Windows, Linux, OSX)
License: MIT License
:video_game: Connect to IRC to send inputs to any program, Twitch Plays Pokemon style. (Windows, Linux, OSX)
License: MIT License
I'm running this in Windows 10, and I'm not sure why it's not working. Python and node.js are installed and the server starts without issue, but I get no response in any application I'm using it with.
let channel = process.env.TWITCH_CHANNEL || "jademalo";
let programName =
process.env.CONFIG_PROGRAM_NAME || "Untitled - Notepad";
My environment should be set up correctly. Typing commands in my chat correctly shows the command in the command prompt, but notepad doesn't respond to anything no matter what I do. The window is focused and I'm sending the chat commands on my phone, so by all accounts it should work.
I've tried running it as administrator, changing the window title to all sorts of different things, checked through the code - the works. I have absolutely no idea why it is not sending any input to a given window. I've event tried forcing the window name at every available point in the code, and I just can't get it to do anything.
Any ideas?
error: { command: 'err_nologin',
rawCommand: '444',
commandType: 'error',
args: [ 'userbame', 'no password!!!' ] }
Even though a password is set
server connects to the IRC channel fine, crashes when someone sends a command matched by regex (command ls sent by twitch_i in this example)
% node ./server.js
twitch_i ls
/home/kuko/twitch/TwitchPlaysX/node_modules/irc/lib/irc.js:759
throw err;
^
TypeError: Cannot call method 'match' of undefined
at Object.sendKey (/home/kuko/twitch/TwitchPlaysX/app/keyHandler.js:28:17)
at Client.<anonymous> (/home/kuko/twitch/TwitchPlaysX/app/server.js:38:24)
at Client.emit (events.js:106:17)
at Client.<anonymous> (/home/kuko/twitch/TwitchPlaysX/node_modules/irc/lib/irc.js:520:26)
at Client.emit (events.js:95:17)
at iterator (/home/kuko/twitch/TwitchPlaysX/node_modules/irc/lib/irc.js:756:22)
at Array.forEach (native)
at Socket.<anonymous> (/home/kuko/twitch/TwitchPlaysX/node_modules/irc/lib/irc.js:752:15)
at Socket.emit (events.js:95:17)
at Socket.<anonymous> (_stream_readable.js:764:14)
%
config.js
//list of commands to filter for
var commands = [
'left', 'right', 'up', 'down', 'start', 'select', 'a', 'b', 'democracy', 'anarchy'
];
var ircConfig = {
//either 'windows' or 'other'
os: 'other',
//program
//title of the window of the program
//ex: Desmume for DS
programName: 'virt-manager',
// programName: 'Desmume',
//IRC
//ex: irc.twitch.tv or 199.9.252.26
server: 'irc.twitch.tv',
//ex: your twitch username
nick: 'removed',
//ex: your twitch username
userName: 'removed',
//oauth token from www.twitchapps.com/tmi
password: 'oauth:removed',
//ex: #twitchplayspokemon
channel: '#removed',
//if you want to join more than one channel
// CLARIFICATION: Main channel has to be in here too!
channelList: ['#removed'],
//other IRC
//default
port: 6667,
//needed for password
// Twitch uses server pass, no sasl
sasl: false,
//if you want to get all messages in real-time keep false
floodProtection: false,
//only needed if true - in milliseconds
floodProtectionDelay: 100,
//config
//if you want to send keys to a program
sendKey: true,
//if you want to print usernames/commands like in twitchplayspokemon
printToConsole: true,
//commands
//example of regex
//don't need to modify if you need anarchy mode
//matches for any of the words in 'commands'
regexCommands: new RegExp('^(' + '.*' + ')$', 'i'),
//if you need to filter the commands sent to the program
//ex: democracy/anarchy since they don't affect the program itself
filteredCommands: [
],
//if you want to prevent people from using from command too often
throttledCommands: [
],
//maximum characters to show for a person's name in the console log
maxCharName: 8,
//maximum characters to show for a command in the console log
//ex: left => left since only 4 char, democracy => democra
maxCharCommand: 60,
//timeToWait between keypresses if you want to limit a certain button
//ex: you can limit 'start' so it's only used every 10 sec
timeToWait: 100,
//keymap for program
//need to set this for your program correcly (vba,desmume,etc)
keymap: {
},
//linux: delay between each possible keypress in ms (can't be too fast)
//if you want to change delay for windows - change key.py
delay: 100
};
module.exports = ircConfig;
Hello, I have configured and installed everything (in theorie), but this thing still won't run. Here is the Debug file:
0 info it worked if it ends with ok
1 verbose cli [ 'D:\Programok\Node.js\node.exe',
1 verbose cli 'D:\Programok\Node.js\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]prestart: [email protected]prestart: no script for prestart, continuing
6 silly lifecycle [email protected]
7 info lifecycle [email protected]start: [email protected]start: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]
9 verbose lifecycle [email protected]start: PATH: D:\Programok\Node.js\node_modules\npm\bin\node-gyp-bin;C:\Users\Bence\Desktop\TwitchPlaysX-master\node_modules.bin;D:\Programok\Git\cmd;D:\Programok\Python;C:\Program Files (x86)\PC Connectivity Solution;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\doxygen\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Skype\Phone;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\QuickTime\QTSystem;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;D:\Programok\Node.js;C:\Users\Bence.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit;D:\Programok\Git\cmd;C:\Users\Bence\AppData\Local\Microsoft\WindowsApps;C:\Users\Bence\AppData\Roaming\npmstart: CWD: C:\Users\Bence\Desktop\TwitchPlaysX-master
10 verbose lifecycle [email protected]
11 silly lifecycle [email protected]start: Args: [ '/d /s /c', 'node ./app/server' ]start: Returned: code: 1 signal: null
12 silly lifecycle [email protected]
13 info lifecycle [email protected]~start: Failed to exec start script
14 verbose stack Error: [email protected] start: node ./app/server
14 verbose stack Exit status 1
14 verbose stack at EventEmitter. (D:\Programok\Node.js\node_modules\npm\lib\utils\lifecycle.js:255:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:191:7)
14 verbose stack at ChildProcess. (D:\Programok\Node.js\node_modules\npm\lib\utils\spawn.js:40:14)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at ChildProcess.emit (events.js:191:7)
14 verbose stack at maybeClose (internal/child_process.js:877:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid [email protected]
16 verbose cwd C:\Users\Bence\Desktop\TwitchPlaysX-master
17 error Windows_NT 10.0.14393
18 error argv "D:\Programok\Node.js\node.exe" "D:\Programok\Node.js\node_modules\npm\bin\npm-cli.js" "start"
19 error node v6.9.2
20 error npm v3.10.9
21 error code ELIFECYCLE
22 error [email protected] start: node ./app/server
22 error Exit status 1
23 error Failed at the [email protected] start script 'node ./app/server'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the TwitchPlaysX package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error node ./app/server
23 error You can get information on how to open an issue for this project with:
23 error npm bugs TwitchPlaysX
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls TwitchPlaysX
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]
Honestly i have no idea what the problem could be. Hope you can help me out! :)
This is what I ended up doing, I made a new Config.JSON with the following as the information without touching the config.jn file. Is this what i'm supposed to do? Where do I save the Config-JSON file??
{
"TWITCH_OAUTH": "My oauth key",
"TWITCH_USERNAME": "twitch username",
"TWITCH_CHANNEL": "twitch username",
"CONFIG_OS": "windows",
"CONFIG_PROGRAM_NAME": "ePSXe",
"CONFIG_MAX_CHAR_NAME": 8,
"CONFIG_MAX_CHAR_COMMAND": 20,
"CONFIG_SEND_KEY": true,
"CONFIG_FILTERED_COMMANDS": [],
"CONFIG_THROTTLED_COMMANDS": []
}
"TWITCH_USERNAME": "TWITCH_NAME_HERE",
"TWITCH_CHANNEL": "#CHANNEL_HERE",
Is the channel name and the username the same thing in the config for twitch?
I managed to get the package.json installed by moving the file (https://github.com/hzoo/TwitchPlaysX/archive/master.zip) to the node modules directory. I typed "npm install" and it magically worked. Now my problem is that the sever refuses to start, I type "npm start" as said in the tutorial and this is what it tells me:
npm start
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path C:\Users\userl\package.json
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\user\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\user\AppData\Roaming\npm-cache_logs\2020-04-26T09_51_38_769Z-debug.log
the tutorial said something about "path" being python, but its already set as path in system variables.
Thanks for the help.
video showing my issue: https://www.youtube.com/watch?v=2BU9fXpzirw
ok so I managed to get the server running right, I cd to my folder (it would have been nice if you would have put CD to the folder in the setup guide) then npm install, and npm start works.
so then I have a config.json file set up with all the info for my stream and I run npm start, I have ePSXe running and centered, I try out a command in chat "a", "b", "s" and... nothing.
Where do I put all the info and my Oauth key? Do I put it in config.js or in a config.JSON file? I tried the "TWITCH_CHANNEL=mychannelhere npm start" and git CMD doesnt recognize it as a command. Is the twitch USERNAME different from the CHANNEL or is it the same thing? Can you make a youtube video or some type of more user friendly guide on how to do this??? Thank you.
All the other commands work the only ones that don't are the arrow keys. I can simply switch it to another key but I thought you should know.
Hello, I have made many adjustments to the time to wait and delay as well as keydelay I still have extreme difficulty with it not registering in the game or it taking quite a long time to register despite the terminal reading the chat logs in sufficient times. There are multiple tests I have done where I have to type "Up" 10 times for it to finally register the up command in the game. I was wondering if there is something I might be missing for these settings.
i start the app with npm start, and it just get stuck on Connecting...
I already setup config.json
robby@robby-U56E:~/TwitchPlaysX$ npm start
> [email protected] start /home/robby/TwitchPlaysX
> node ./app/server
sh: 1: node: not found
npm ERR! Linux 4.10.0-28-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "start"
npm ERR! node v4.2.6
npm ERR! npm v3.5.2
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! [email protected] start: `node ./app/server`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the [email protected] start script 'node ./app/server'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the TwitchPlaysX package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./app/server
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs TwitchPlaysX
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls TwitchPlaysX
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/robby/TwitchPlaysX/npm-debug.log
robby@robby-U56E:~/TwitchPlaysX$
Updating node does not help.
I'm on a mac, and I have managed to get it so Twitch chat commands are being printed in Terminal so the server is connect, but it won't pass any keys to any programs I configure. I poked around inside KeyHandler.js and figured out the problem is in setWindowID(). After going through this section the windowID returns no value. It doesn't seem to matter how I configure the program name in config.js, it always returns nothing. How do I make it so my windowID is set to the right value?
The program itself is working without any errors, but it doesn't seem to actually activate any of the keys it gets as input. I've tried multiple programs (notepad, atom, WordPad, VirtualBoyAdvance-M etc.) but it doesn't do anything in any of them. I'm running Windows 10, Python 3.9 x64 and PyWin32 3.9 x64.
Any help would be much appreciated!
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.