A desktop application to automatically get text-only contents from reddit, bind them to keyboard keys in a Valve game, share them in the chat with the other players. The GUI is made with ElectronJS, while the scripts that handle everything else are written in Ruby.
This project was originally made to get only dad jokes from reddit, but I realized I could make it work with other text-only subreddits so I went with that!
*I've tested the project & installations guides only on Linux.
-
I find dad jokes incredibly funny, so I've been enjoying spamming them in the chat for the other players to read & laugh (some find them unfunny, which is fair, but I like making them read them anyways haha).
-
I've lately been doing this manually, copy-pasting jokes and binding them to keys, which would take me quite a bit of time daily and eventually made me lazy to update them, so I thought why not automate the whole thing.
-
If you face any issues, contact me on reddit /u/jee-el, or open an issue on this repository.
-
The guides provided are just a few out of plenty, so feel free to use any other guide(s) to get Git, Ruby, Bundler & NodeJS installed.
-
Also, the linux guides are mainly for Ubuntu and its official flavors, but it should be easy to find guides for other distributions.
-
In this guide, we'll use the game Counter Strike Global Offensive, but this should work on any other valve game that has a console and a chat system, so if you are doing this to another game, just browse/open the folders for your specific game.
-
I'll also use the /r/dadjokes subreddit here, but you can try the same script with other subreddits that allow text-only posts. See Multiple Subreddits on how to use with other subreddits.
Follow this guide until 1:48 :
Follow only the first step (Step 1) of this guide :
https://www.theodinproject.com/lessons/foundations-setting-up-git
https://learn.microsoft.com/en-us/windows/dev-environment/javascript/nodejs-on-windows
https://www.theodinproject.com/lessons/foundations-installing-node-js
You can install it on here :
And here's a video that will guide you through the installation process :
Follow this guide :
https://www.theodinproject.com/lessons/ruby-installing-ruby
Feel free to ignore the "Extras" section.
In your terminal or git bash :
gem install bundler
git clone https://github.com/Jee-El/reddit-in-valve-games.git
cd reddit-in-valve-games
I'm assuming you are in the reddit-in-valve-games
directory for the rest of this guide.
bundle install
npm install electron --save-dev
Run npm run start
.
At this point, if you are familiar with setting an autoexec.cfg
file, just add +exec dadjokes
or +exec dadjokes.cfg
in the launch options of the game you want to use this on (without making the file, & replace dadjokes
with whatever the subreddit's name is or with whatever you named it)
Then you can jump straight to the IMPORTANT section.
Otherwise, follow these steps :
Select one of the available subreddits or add a new one.
I'm going to select dadjokes
.
- For Windows
It looks like this for all valve games:
C:\Program Files (x86)\Steam\userdata\STEAMID\730\local\cfg
Replace STEAMID with yours.
- For Linux
It looks like this for all valve games:
/home/HOSTNAME/.steam/steam/userdata/STEAMID/730/local/cfg
Replace STEAMID with yours.
Make sure to use /home/HOSTNAME
rather than ~
.
It looks like this for CSGO :
- On Windows
C:\Program Files (x86)\Steam\steamapps\common\Counter-Strike Global Offensive\csgo\cfg
- On Linux
/home/HOSTNAME/.steam/steam/steamapps/common/Counter-Strike Global Offensive/csgo/cfg
The second path looks fairly similar for other valve games too.
To get the path for other games :
-
Navigate to the common folder to find the other games' folders & and open the folder you want.
-
You'll find another folder with same name (or similar), open it.
-
Open the folder called
cfg
. -
Copy the path that led you there.
Normally, only one of the paths is necessary, but I've had issues before with the .cfg file, sometimes it worked on the first path, sometimes on the second, so just use both since there is no downside to that.
If you want, you can experiment with this by leaving one of the input fields for the paths empty and keeping the other. Once you find the working one, use it alone.
Now go to the keys
input field, and enter the keys you want the jokes to be bound to and save the changes.
I suggest you use an even amount of keys, e.g: 2, 4, 6, 8 etc.
Wondering about what dadjokes.cfg file we're talking about? Don't worry, the script will make it once you run it.
steam => view (top left) => library => Find your game and right click on it => properties => general => launch options
Now type : +exec dadjokes
If later you realize that it doesn't work, try : +exec dadjokes.cfg
Click on Add A Subreddit
, the steps are fairly similar to the ones above.
Click on the Run
button.
Open csgo, or your valve game of choice, and enjoy sharing the jokes in the chat!
You can type, in the console (as in, the CSGO/CSS/whatever console, not gitbash nor terminal), this command to see if the binds have been updated :
key_listboundkeys
I'm facing an issue on Linux (Ubuntu) where the binds don't apply to the game automatically, though the .cfg file gets updated, so it's an issue with my OS or the game. If you face the same issue, you can either run exec dadjokes
in the console (again, the CSGO/CSS/whatever console), everytime you run the script and everything will work as it should, or bind a key to do that for you :
bind "f1" "exec dad_jokes"
In this case, you just press F1 each time you run the script and you want to update the binds. (You must be in-game, of course)
-
Save a copy of your config.json outside the
reddit-in-valve-games
directory. -
Navigate to the
reddit-in-valve-games
directory/folder, then rungit pull
.
-
For the subreddit name input field, don't enter the name of a .cfg file that's already in either/both paths. For example, it's common to have a file called config.cfg or autoexec.cfg, so don't enter
config
orautoexec
, it'll delete all the contents inside them. -
Currently the script will work, meaning you can click on the
Run
button, a maximum of 30 times a day (since the last time you ran the script for the first time), sometimes less, this is because sending too many requests to reddit sounds like a bad idea. The good thing is that the hot pages of subreddits aren't updated often enough for you to run the script many times for a meaningful reason, so you'll just see the same contents bound to the same keys.