Giter Site home page Giter Site logo

kataiser / tf2-rich-presence Goto Github PK

View Code? Open in Web Editor NEW
59.0 7.0 8.0 382.59 MB

Discord Rich Presence for Team Fortress 2

License: GNU General Public License v3.0

Python 81.05% Batchfile 0.15% HTML 17.72% Inno Setup 1.08%
discord tf2 teamfortress2 python game rich-presence steam gui application

tf2-rich-presence's Introduction

Github all releases GitHub release GitHub Release Date Platform: Windows Kataiser on Steam Ko-fi

GitHub commits since latest release GitHub last commit Updates Codacy Badge Github Actions build Coverage

TF2 Rich Presence

Discord Rich Presence for Team Fortress 2

  • Detects current game state, queue info, playtime, and more
  • Configurable, reliable, and performance-efficient
  • Version 2 (GUI, map images, and more): out now!

Preview image

GUI preview image

Download and install

Installer: TF2RichPresence_v2.1.8_setup (18.3 MB)
Alternatively, get the latest autobuild (may be untested/buggy): TF2RichPresence_v2.1.8_setup
Note that having Python installed is not required. Requires Discord and Steam to be running as well, and will wait until the game and both programs are running.

Changelogs

Linux and MacOS support?

At the moment, both are considered unsupported. They probably work since Jan200101 did some work on Linux a while ago, but the release builds are formatted for Windows. Contributors are very welcome! Also check out cyclowns/tf2-discord, which is confirmed to work on both Windows and Linux, or EmeraldSnorlax/TF2-RPC, which is a much less mature program but is built on Linux and theoretically cross-platform too. Alternatively, following most or all of the "building from source" instructions might work, or possibly running python resources/launcher.py in a --nocython build.

VAC safe?

Almost certainly. If you don't want to risk it then fair enough, but I've run this on my main account for years and feel comfortable with it. The game's runtime and memory are never touched in any way to read its state. For transparency, here's the complete list of external files that are read from and/or written to: \tf\console.log, \tf\cfg\*class*.cfg and steam_appid.txt in TF2's install, and \userdata\*id*\config\localconfig.vdf and \steamapps\libraryfolders.vdf in Steam's. The game process is also queried for its start time and install path, and the server you're playing on is queried for player count, server name, or kill counts. RCON is not used.

Building from source

For making and testing changes, or simply always running the most up-to-date code.

  1. Either clone the repo or download the source.
  2. Copy the entire source to another location (sorry) and put the files outside of TF2 Rich Presence into that folder.
  3. Make sure the python and pip commands point to Python 3.9.x (future versions should work too).
  4. Install a C compiler (see Installing Cython). I personally use MinGW, but it's a pain on Windows. Alternatively, use the --nocython flag when building to disable compiling.
  5. From within TF2 Rich Presence, run pip install -r requirements.txt.
  6. Either run python build.py to compile and build, or python launcher.py to launch in debug mode.

Version 2 goals

  • A GUI (Done, ended up using discoIPC still)
    • I'm fairly confident I know how to implement this (it's a bit of work though)
    • Would require doing RPC with pypresence due to a bug in discoIPC
    • Would also have the benefit of not requiring two (slow) Python interpreter launches
    • This is the only criteria I'll require for release v2.0, any of the others could be in later versions
  • Run as a service (Abandoned because "launch TF2" button OP)
  • Map-specific images, instead of gamemodes (Done, also Discord increased the limit to 300)
    • Would cause all sorts of problems, including removing the class icon style option
    • Discord art asset limit is 150, the rest of the program uses 47, and there are 118 vanilla maps in the game
    • So won't be able to get every map, can just limit to the most popular though
  • A proper installer (Done with Inno Setup, no autoupdater though)
    • Also maybe store DB.json and settings in AppData\Roaming
    • Make a Chocolatey package as well, ideally would need to fix antivirus detection
    • Possibly include an autoupdater, either Squirrel or rolling my own

tf2-rich-presence's People

Contributors

blueberryy avatar dzndani avatar forusu avatar hinataaki avatar jan200101 avatar kataiser avatar kotoki1337 avatar pyup-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

tf2-rich-presence's Issues

Licensing issues

At the moment the 7zip executable is being bundled in this repository, which is licensed under GNU LGPL
because of that tf2-rich-presence must be under LGPL 2.1 or later

Localization improvements

Localization is currently done almost entirely with automated translators (DeepL and Yandex), and therefore probably have unnatural language used in it. Only Spanish has been (somewhat) reviewed by a native speaker, and so more help would be very appreciated. Localization data is in localization.json.

Giving Error at Startup

I extracted the .zip to a folder on my desktop and when I started it, it gave me this text and said it'll restart after 5 seconds:

Traceback (most recent call last):
File "C:\Users\Teddy\Desktop\Games\Game Folders\TF2 Rich Presence v1.13\resou
rces\launcher.py", line 60, in launch
loaded_module.launch()
File "main.py", line 91, in main.launch
File "main.py", line 81, in main.launch
File "main.py", line 128, in main.TF2RichPresense.run
File "main.py", line 165, in main.TF2RichPresense.loop_body
UnboundLocalError: local variable 'valid_usernames' referenced before assignment

After it restarts, it shows the same thing again.

The application does not load

When I want to open the TF2 Rich Presence application, it keeps loading.

When you hover the cursor over the application icon, it appears all black and if you click on it, it does not open.

TF2 Rich Presence crash

This happens to me with both the stable version and the latest development version: eaa2eaa

Opening the application with the administrator permission does not solve anything, in fact an error message appears (the latter I only tested in the latest development version).
TF2 RIch Presence crash (Admin)

Program crashes on initialising

Probably a duplication from issue #90 but since that one was already closed.
Doesn't matter what exe I start from, the program crashes.
I assume this is due some older settings leftover from an older version of the program.

[1587834973 +0.0006] INFO: Initializing TF2 Rich Presence v1.13.1
[1587834973 +0.0001] DEBUG: Current log: logs\TF2RP_ByteCruncher_maxim_v1.13.1_18377.log
[1587834973 +0.0000] INFO: Log level: Debug
[1587834973 +0.0066] DEBUG: Welcoming with message version 1
[1587834973 +0.0061] DEBUG: Checking for updates, timeout: 5.0 secs
[1587834973 +0.2303] DEBUG: Up to date (v1.13.1)
[1587834973 +0.0001] DEBUG: Closing log file via destructor
[1587834974 +0.0083] INFO: Starting TF2 Rich Presence v1.13.1
[1587834974 +0.0003] DEBUG: Deleted 0 log(s): []
[1587834974 +0.0001] DEBUG: Compressed 0 log(s): []
[1587834974 +0.0001] DEBUG: CPU: 4 cores, 4 threads
[1587834974 +0.0004] DEBUG: Platform: {'architecture': ('32bit', 'WindowsPE'), 'machine': 'AMD64', 'system': 'Windows', 'platform': 'Windows-10-10.0.18362-SP0', 'processor': 'Intel64 Family 6 Model 94 Stepping 3, GenuineIntel', 'python_version_tuple': ('3', '7', '6')}
[1587834974 +0.0007] DEBUG: Set process priorities from (<Priority.NORMAL_PRIORITY_CLASS: 32>, <IOPriority.IOPRIO_NORMAL: 2>) to (<Priority.BELOW_NORMAL_PRIORITY_CLASS: 16384>, <IOPriority.IOPRIO_LOW: 1>)
[1587834974 +0.0004] CRITICAL: Traceback (most recent call last):
File "main.py", line 90, in main.launch
File "settings.py", line 421, in settings.compare_settings
KeyError: 'trim_console_log'

Then this error start looping every 5 seconds,

[1587834974 +0.0000] DEBUG: Closing log file via destructor
[1587834979 +0.0014] INFO: Starting TF2 Rich Presence v1.13.1
[1587834979 +0.0003] DEBUG: Deleted 0 log(s): []
[1587834979 +0.0001] DEBUG: Compressed 0 log(s): []
[1587834979 +0.0001] DEBUG: CPU: 4 cores, 4 threads
[1587834979 +0.0003] DEBUG: Platform: {'architecture': ('32bit', 'WindowsPE'), 'machine': 'AMD64', 'system': 'Windows', 'platform': 'Windows-10-10.0.18362-SP0', 'processor': 'Intel64 Family 6 Model 94 Stepping 3, GenuineIntel', 'python_version_tuple': ('3', '7', '6')}
[1587834979 +0.0002] DEBUG: Set process priorities from (<Priority.NORMAL_PRIORITY_CLASS: 32>, <IOPriority.IOPRIO_NORMAL: 2>) to (<Priority.BELOW_NORMAL_PRIORITY_CLASS: 16384>, <IOPriority.IOPRIO_LOW: 1>)
[1587834979 +0.0004] CRITICAL: Traceback (most recent call last):
File "main.py", line 90, in main.launch
File "settings.py", line 421, in settings.compare_settings
KeyError: 'trim_console_log'

Crash when loading tr_walkway_rc2

Note1:

that I removed the following lines as for the program not finding my console log file (Even though it works just fine after removing these lines) Only thing not working is the automatic download of map images...
# -condebug is kinda necessary so just wait to restart if it's not there input("Press enter to retry\n") raise SystemExit

Note2:
I changed the instructions on how to enable the console dump to "You look great today!"

CRASHLOG:

TF2 Rich Presence has crashed, the error should now be reported to the developer.
(Consider opening an issue at https://github.com/Kataiser/tf2-rich-presence/issues)
Restarting in 2 seconds...
You look great today!

Traceback (most recent call last):
File "E:\EigeneDateien\RICHPRESENCE\resources\main.py", line 50, in launch
app.run()
File "E:\EigeneDateien\RICHPRESENCE\resources\main.py", line 85, in run
self.loop_body()
File "E:\EigeneDateien\RICHPRESENCE\resources\main.py", line 164, in loop_body
top_line, bottom_line, server_ip = self.interpret_console_log(os.path.join(tf2_location, 'tf', 'console.log'), valid_usernames)
File "E:\EigeneDateien\RICHPRESENCE\resources\main.py", line 346, in interpret_console_log
if 'Disconnect by user' in line and [i for i in user_usernames if i in line]:
TypeError: 'NoneType' object is not iterable
`

RPC GUI fails to display - Shows up black and crashes if ran as admin

When the app is launched it shows that the app exists and is running, working as normal on Discord and TF2, but it fails to display the GUI of the app itself, instead showing as a black window in alt-tab or taskbar, while not appearing at all when tabbed to. When ran as admin it states that a pythonw.exe is missing from resources. If there are further logs to send I would be more than happy to send those, but I do not know where they are, nor if they exist.

What it looks like in taskbar:
image

What occurs if ran as admin:
image

[Request] Close when TF2 is Closed

Using "%COMMAND%" in steam, and --launch, I have the program open when TF2 opens. This works fine, but it remains open when TF2 is closed. I would like to request an option for this if possible.

Kills

The kill counter does not work

crash when launching the exe

whenever i launch any of the exe files, it doesn't work. the error is

Traceback (most recent call last):
File "F:\TF2 Rich Presence v1.13.1\resources\launcher.py", line 67, in launch
loaded_module.launch()
File "main.py", line 102, in main.launch
File "main.py", line 90, in main.launch
File "settings.py", line 421, in settings.compare_settings
KeyError: 'trim_console_log'

i think this might be caused by my game directory being under a different drive to steam?

Batch File opens and closes immediately.

Tried installing the new version of the rich presence, the installation was successful. However when I try to open the program, it closes immediately after a millisecond. I even have Python installed, is there something I am doing wrong or is it a main issue?

I am running on Windows 10.

Initial Update

The bot created this issue to inform you that pyup.io has been set up on this repo.
Once you have closed it, the bot will open pull requests for updates as soon as they are available.

MacOS support

I don't own a Mac, but I'd like this project to work on MacOS anyway.

Any chance of Linux support?

Seeing as its all python it should be relatively easy to port -- trying to run build.py or main.py just crashes on me -- perhaps because of using \ for paths instead of / ?
Output of tests.py is here

App is extremely buggy

Hey. So I installed it. First off, after installing it the RPC would be stuck at "Menu". Then after rebooting my PC, it freezes on launching, then when it does launch it freezes time after time.

run as service/tray icon

Run as a service (Abandoned because "launch TF2" button OP)

a button inside the app to launch tf2 is still inconvenient and doesn't replace the app being a background process. having the presence launch on windows startup and run in the background as a service or as a system tray icon is a lot more convenient. this requires no manual opening or closing of the presence, just launching tf2 like normal, which is a hell of a lot more seemless

Errors with libstdc++.dll

Ever since the most recent update (as of 11/29/19), upon executing any executable from within the included files (Change settings.exe, Launch Rich Presence alongside TF2.exe, Launch TF2 with Rich Presence.exe), a blank terminal for the executable pops up and I get an error as shown in the provided screenshot:

image

Following the instructions to the error, I redownload both the .zip and setup executable to which the same error occurs.

[Request] Custom RPC Images

I've been mostly happy with the program but I can't say the same about some of the images used, especially the main menu one. I'd like to request some kind of system for users to use images of their choice if that's feasible.

Maybe you could make any image edits made in C:\Users\USER\AppData\Local\Programs\TF2 Rich Presence\resources\gui_images reflect on to the actual images on your profile?

Or maybe you could allow the user to select a custom application ID that would contain their custom images?
(This is how Minecraft's RPC mod does it.)

I'm sorry if nothing I suggested is possible, I'm not familiar with how this works.

Need help over here

Whenever I start it, a cmd window opens and keeps spamming "The system cannot find the path specified." can you please tell me what's wrong?

Application won't open although it is running on the taskbar

The application is running on my computer like usual, but when you click on the app the window isn't being brought up. Is it an issue of some sort? I am trying to change some settings but it won't even let me. It's stuck on a black screen
image

bug

in the latest version (2.1) it's not updating the class I'm using

Cannot build?

How long does it take to build the source? Did everything exactly as said but it is stuck on "Building TF2 Rich Presence v1.13.2". Using Python v3.7.7

Cannot open app UI after v2.1 release

Been using this rich presence for some time now, worked pretty good (except the things at the bottom of this post), but after v2.1 the whole UI for the rich presence is broken. I simply cannot alt tab, or click on the app when its started.
obrázok_2021-10-10_124123
image

Other things i have noticed:

  • Class is always "unselected" (Tried re-installing the RP app and TF2, didn´t help).
  • Sometimes after disconnecting from a server, it will show the server (instead of being in the main menu) info untill i requeue or join another server.
  • The kill counter didn´t work once, fixed it by just restarting TF2 (Seems to be fixed now).

Off-topic: Do you need a translator by any chance?

translation failure in the Spanish language

Hello, I would like to report a translation failure in the Spanish language. To begin with, the TF2 icon says "Equipo Fortaleza 2" in Spanish, we do not say it directly, we called it in English originally. And also in the classes, we don't call the classes in their Spanish translation, we originally called it as it is in English, well that's it, the rest is well translated ...

image

image

Stuck in Menu

The Rich Presence is stuck displaying that im on Menus despite after playing several matches

GUI doesn't work for some reason

Did a fresh install of the app and can't open the gui. The actual rich presence works fine, but I can't un-minimize the app (probably because there's no gui actually open?)
I use the .bat file included with the install to open the app
изображение
Basically, when I click on this black rectangle, nothing opens

After changing map program show "in main menu" state despite be on server.

When first time I connect to "Potato's MvM Holographic Harvest server" (for example, 92.38.186.127:27053) or "EL Grapes's Server" (46.174.50.33:27210) program detects what I'm on server. But when map is changed program show what I'm in main menu despite I'm still on server. If I rejoin then problem returns to "first connected to server" step.
console.log
TF2RP_LAPTOP-JU5GUNO3_199930_v2.1.2_3.log

Looks like line 174 in console_log.py cauising it.

Example of bug from console.log and TF2RP_LAPTOP-JU5GUNO3_199930_v2.1.2_3.log:

Connecting to server:

  • "Map: mvm_villa_b5c" (Line 102806 of console.log)
  • "[Nov 11 02:23:29 +0.0694] DEBUG: console.log parse results: (False, 'mvm_villa_b5c', '', '92.38.186.127:27065', 'Not queued', False)" (Line 14453 of TF2RP_LAPTOP-JU5GUNO3_199930_v2.1.2_3.log)

Vote to change map is called:

  • "mark_2" (Line 103324 from console.log)

Connecting to server after map change:

  • "Map: mvm_legerdemain_a6e" (Line 103326 of console.log)
  • "SoundEmitter: removing map sound overrides [5796 to remove, 1979 to restore]" (Line 103332 of console.log)
  • "[Nov 11 02:26:40 +0.0593] DEBUG: Menus message used: "SoundEmitter: removing map sound overrides [5796 to remove, 1979 to restore]"" (Line 15299 of TF2RP_LAPTOP-JU5GUNO3_199930_v2.1.2_3.log)
  • "[Nov 11 02:26:40 +0.0000] DEBUG: Game state updated from (Medic on mvm_villa_b5c, gamemode=mvm, hosting=False, queued="Not queued", server=92.38.186.127:27065) to (in menus, queued="Not queued")" (Line 15305 of TF2RP_LAPTOP-JU5GUNO3_199930_v2.1.2_3.log)

Errors and recommendations

Hello, from a translator I am going to give you the errors that I saw in this mod. But I will also give recommendations for the mod.

1. The menu image does not match the rest of the map or game mode images. I recommend doing the same as they did in the Mirrorcult mod (https://github.com/mirrorcult/tf2-discord).

TF2 Rich Presence (Menú)

2. Rich Presence does not detect that you are in the menu when you are no longer playing on a server.
It only changes when you connect to another server.

TF2 Rich Presence (Server)
TF2 Rich Presence (Other server)

3. I recommend not translating the community game modes, as very literal and forced translations can be generated (as is the case with the "Deathrun" game mode).

TF2 Rich Presence (Forced translation)

4. I recommend, if possible, adding interactive frames in the Rich Presence, in the style of the ROBLOX ItzBlinkzy mod (https://github.com/ItzBlinkzy/roblox-rpc).
They can be boxes that take you to your Steam Profile and another to the server where you are connected; but there is also an option to block this last feature for those who do not want to share the server).

Roblox RPC mod

5. And finally, add the server name you are playing on, in the style of the previous TF2 RIch Presence mod from Mirrorcult that I passed.

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.