Giter VIP home page Giter VIP logo

codexlink / discord-activity-badge Goto Github PK

View Code? Open in Web Editor NEW
20.0 2.0 8.0 4.88 MB

Bridge your discord's state and activity to a representable badge on your repository / profile to show your discord's current status. Powered by Docker and Python + AsyncIO + discord.py + aiohttp.

License: Apache License 2.0

Dockerfile 0.38% Python 99.62%
discord-python badge-generator github-action-docker github-profiles discord-presence python3 github-api discord discord-bot-client

discord-activity-badge's Introduction

Refactorization Notice

I have seem to notice that a few or so has interest on this small project. Please note that I will be doing code refactorization if ever I will pass off my final thesis starting June. Please refer to #12 for more information (will be updated).

Discord Activity Badge (Initial Release)๐ŸŒ‡

Example Online Example Idle Example DND Example Offline Example Playing Game Basic Example CustomActivity + State Example CustomActivity + State Example NoSubjectColor + SubjectCustomized Example Streaming + Idle + Detail + Elapsed + Shifted + CustomColor Example Busy + CustomActivity Example Offline + CustomSubject + CustomColor Example BotStyle + Watching + Do-Not-Disturb + Elapsed + NotShifted + CustomColor Example UpTimeBot + NoCustomColor Example Playing Game + CustomActivityColor

A containerized action that bridges the Discord User's Activity and their Status State to a Representable Badge for their Special Repository (Github Profile) and soon, for open-sourced Discord Bots.

Powered by Docker and Python + AsyncIO + discord.py + aiohttp.

Container Tester Containerization | Discord Activity Badge LGTM Alerts

Codacy Code Quality Grade CodeFactor Code Quality Grade LGTM Code Quality LGTM Calculated Line of Code

Open in Visual Studio Code Repository License

Why?

Because why not? If you ever wanted to show your status with context aside from your Github Status, or wanting to go beyond styling your README by adding some extra toppings, or wanting to let some birds (strangers) know what you are doing at some point in time, then this action workflow might be for you!

Disclaimer: I did this for fun. But that fun were took over my standards. Check out wiki for more information.

Steps

The following contains the steps needed to make this action work properly. Keep in mind that this is quite hectic but easy, the steps were alot because this is the cheapest way to do this thing.

  • Creating a Bot and obtaining its Token in Discord Developers
  • Inviting the Bot to a Guild
  • Preparing the Workflow
  • Repository Secrets
  • Workflow Dispatch

Creating a Bot and obtaining its Token in Discord Developers

Ever since I don't provide anything such as the Bot that I use for reading my activities, you have to make it on your own. You can go to Discord Developers and start ahead by creating a new application.

Image 1

Once you have created a new application, you have to go to the sidebar or menu and go to the Bot settings, and add a bot. And then, copy the token and store it somewhere temporarily as we are going to use it later on in the next two steps.

Image 2

As a side note, you have to enable the presence and server members intent on the same settings (Bot settings) to allow your bot to read your presence context and the members' states and other kinds of stuff about them.

Image 3

Don't forget to save before proceeding to the next step!!!

Inviting the Bot to a Guild

Inviting the bot and having them in the guild is the only way to read User's Presence and their State, as per the limitation of Discord API.

Keep in mind that, you can either create your own guild or have someone else let the bot join on their guild as long as you are there.

To invite, you have to go to the OAuth2 settings and check the OAuth2 URL Generator. Look for Bot scope and check it, you will be given a generated link.

Image 4, GIF

Once you have the link, you just have to paste it into the browser and open it.

Image 5, GIF

Image 6

And there you have it! Once you have done this part, the only thing left is to have a workflow in your repository.

Preparing the Workflow

Paste the following YAML on your (profile) repository under the directory .github/workflows and commit it.

name: Discord Rich Presence Activity Badge

on:
  schedule:                 # Scheduling with Github Actions is inconsistent.
    - cron: "5 0-23 * * *" # Construct your Cronjob Schedule at https://crontab.guru/.

  workflow_dispatch:        # Enables you to dispatch the workflow at your click.

jobs:
  BadgeUpdater:
    name: Static Badge Updater
    runs-on: ubuntu-latest

    steps:
      - name: Update README Discord Badge to Latest Upstream
        uses: CodexLink/[email protected] # Choose your own version by picking a tag or a branch name. Using a tag is recommended.
        with: # Go to your Repository Secrets and fill those up!
          DISCORD_USER_ID: ${{ secrets.DISCORD_USER_ID }}
          DISCORD_BOT_TOKEN: ${{ secrets.DISCORD_BOT_TOKEN }}

This workflow will run once it has been dispatched (manually) or is scheduled to run for every 5 minutes per 0 to 23 hours to check for the user's status.

Repository Secrets

To be able to provide your information, you have to go to your repository > Settings > Secrets > New Repository.

Image 7

In the end, you should have these two repository secrets. The token is from the one that we obtained in the Discord Developers Section, and the one is from you yourself in the Discord Client.

DISCORD_USER_ID can be obtained by the following.

Image 8, GIF

Workflow Dispatch

When you finished all the steps, the last thing to do was to manually push it to see changes.

Image 9

Post-Step

If you did the run for the first time, the badge wil appear on the top of your README, you can adjust it to somewhere else and the badge will be replaced by the script, no matter where it is.

Image 10 (A)

And that's done! For further customizations, please read the other sub-sections below.

Workflow Parameters

The following sub-sections contain a set of possible inputs that you can integrate with this workflow.

Required (In-Need-of-Evaluation) Parameters

These inputs are required in order to run the Docker Container.

Inputs Type + Defaults Description
BADGE_IDENTIFIER_NAME str: (Script) Discord Activity Badge The name of the badge (in markdown form) that will be utilized to replace the badge state side's contents. If the identifier does not exist, it will proceed to create a new one and append it on the top of your README. You must arrange it right after.
COMMIT_MESSAGE str: Discord Activity Badge Updated as of datetime.datetime.now().strftime("%m/%d/%y โ€” %I:%M:%S %p") ***See constants.py The commit message that will be invoked in the commit context when there's are some changes to push.
DISCORD_BOT_TOKEN str (Required) The token of your bot from Discord's Developer Page. Note that, you have to use your own bot! Go check Discord Developers.
DISCORD_USER_ID int (Required) An integer ID used to identify you in Discord.
PROFILE_REPOSITORY str: GITHUB_ACTOR/GITHUB_ACTOR The repository from where the commits will be pushed. Fill this up when you are indirectly deploying the script under a different repository.
URL_TO_REDIRECT_ON_CLICK str: PROFILE_REPOSITORY value. The URL to point when the badge has been clicked.
WORKFLOW_TOKEN str (Required) The token of the Github Workflow Instance used to authenticate commits deployed by the script. Fill this up if you want to test locally so that you aren't going to be rate limited. Using user-generated token can give 5000 API requests!

Parameters that are required have to be explicitly stated in the workflow. Otherwise, it will lead to an error. Regardless of the types, it will be resolved by the script, this is just an indicator that those will be explicitly converted to what has been told here.

Optional Parameters

These inputs are optional and have the capability to override the display of the badge and the commit message. Allowing extensibility and customization that allows you to render multiple ways of designing your badge.

Colors and Intentions

If you wanna change how things should be delivered (context) and how they should look like (color), then this set of parameters will help you modify the way how it looks. Keep in mind that the labels [n] in the parameters is a number, and is corresponding to a set of choices. Please check the options under the table.

Parameters Description + Result
str [1]_STRING Note: Each state (as options) is almost the same context from output to choices. Overrides Discord Activity (Subject String) and User State with the state of Playing, Watching, and Listening with custom strings; this avoids making the status longer and balanced. If this is a CustomActivity, it will append User's State [Online, Idle, DND, Offline] instead.

Demo #1
str [2]_STATUS_STRING Note: Please check fallback_values in elements/constants.py Overrides the status output in online / idle / dnd / offline states.

Demo #2
str [1]_COLOR Note:HEX RGB only Renders status badge color whenever there's a certain activity. Which renders the user's state color in the subject, if a certain activity has color specified. Leaving these settings by default (None) will result to render the user's state color. See example of APPEND_STATE_ON_SUBJECT. That should ignore SHIFT_STATE_ACTIVITY_COLOR if that is the case.

Demo #3
str [2]_STATUS_COLOR Note: HEX RGB only Overrides the status color when the user is in online / idle / dnd / offline states.

Demo #3
str STATIC_SUBJECT_STRING Defaults to: None Statically declare a certain string to display on the subject. If declared, []_ACTIVITY_STRING and []_STATUS_STRING will be ignored.

Demo #4
  1. Options: CUSTOM_ACTIVITY, GAME_ACTIVITY, RICH_PRESENCE, STREAM_ACTIVITY, and SPOTIFY_ACTIVITY.
  2. Options: ONLINE, IDLE, DND, and OFFLINE.

I separated the options along with the parameter to avoid confusion while reading it.

Context

Whenever you want to change the context of the badge, you can use this set of parameters for extending the context or shorten it.

Parameters Description + Result (If there's any)
str PREFERRED_PRESENCE_CONTEXT Options: [DETAILS, STATE, CONTEXT_DISABLED] Overrides additional information to append in the badge. So far, only DETAILS and STATE are allowed to be appended since it shows the other context of the application.
str TIME_DISPLAY_OUTPUT Options: [TIME_DISABLED, HOURS, HOURS_MINUTE, MINUTES, SECONDS] Appends time (based on preference) after the application name or the detail of the activity when APPEND_PRESENCE_CONTEXT is True.

Demo #6
str TIME_DISPLAY_ELAPSED_OVERRIDE_STRING Defaults to: elapsed. Overrides the string appended whenever the time is displayed for elapsed. This is effective only when SHOW_TIME_DURATION is True.

Demo #7
str TIME_DISPLAY_REMAINING_OVERRIDE_STRING Defaults to: remaining. Overrides the string appended whenever the time is displayed for remaining. This is effective only when TIME_TO_DISPLAY is True.

Demo #8
bool TIME_DISPLAY_SHORTHAND Defaults to: False Displays the time with hours and minutes shorthanded to h and m.

Demo #9

Preferences

Parameters Description + Result
str PREFERRED_ACTIVITY_TO_DISPLAY Options: [CUSTOM_ACTIVITY, GAME_ACTIVITY, RICH_PRESENCE, STREAM_ACTIVITY, SPOTIFY_ACTIVITY] Renders a particular activity as a prioritized activity. If the preferred activity does not exist, it will render any activity by default. There will be no demo since it only picks what activity should be displayed.
bool SHIFT_STATE_ACTIVITY_COLORS Defaults to: False Interchange state and activity colors. This is useful only if you want to retain your state color position even though APPEND_STATE_ON_SUBJECT is true. Demo #11
str (char) SPOTIFY_INCLUDE_ALBUM_PLAYLIST_NAME Defaults to: False Displays the album or the playlist from where the song is being played. Enabling this will keep the badge long enough to capture one whole line of the README! Demo #12
str (char) STATUS_CONTEXT_SEPERATOR Defaults to: , The character/s that separates the context of every status elements. Keep note that, once you declared a value on this parameter, it will automatically add space from both ends to ensure that the content displays properly. If otherwise, the script will do the spacing on its own. Demo #13

You got some ideas or did I miss something out? Please generate an issue or PR (if you have declared it on your own), and we will talk about it.

For more information on how the script renders the badge based on preferences, please check the badge.py.

Development Parameters

When developing, there are other fields that shouldn't be used in the first place. Though they are helpful if you are planning to contribute or replicate the project.

Parameters Type Default Description
IS_DRY_RUN bool False Runs the usual process but it doesn't commit changes.

The list does seem to contain only one parameter. Worry not, there will be more parameters to be introduced in the future!

Credits

Here contains a list of resources that I have used in any form that contributed to the development of this repository.

Used Libraries and Technologies

  • argparse โ€” Parser for command-line options, arguments and sub-commands.
  • ast โ€” Parser for command-line options, arguments and sub-commands.
  • aiohttp โ€” Asynchronous HTTP client/server framework for asyncio and Python.
  • asyncio โ€” is a library to write concurrent code using the async/await syntax (Asynchronous I/O).
  • Badgen.net โ€” Fast badge generating service.
  • base64 โ€” Base16, Base32, Base64, Base85 Data Encodings.
  • black โ€” The uncompromising Python code formatter.
  • Discord.py โ€” An API wrapper for Discord written in Python.
  • Docker โ€” Empowering App Development for Developers
  • datetime โ€” Basic date and time types.
  • discord.py-stubs โ€” Literally Discord.py Stubs for typing library.
  • enum โ€” Support for enumerations.
  • flake8 โ€” flake8 is a python tool that glues together pycodestyle, pyflakes, mccabe, and third-party plugins to check the style and quality of some python code.
  • logging โ€” Logging facility for Python.
  • mypy โ€” Optional static typing for Python 3 and 2 (PEP 484).
  • urllib3 โ€” Python HTTP library with thread-safe connection pooling, file post support, user friendly, and more.
  • os โ€” Miscellaneous operating system interfaces.
  • Poetry โ€” Python dependency management and packaging made easy.
  • Python โ€” an interpreted high-level general-purpose programming language.
  • Pythex โ€” FIrst regular expression checker that I have used.
  • python-dotenv โ€” Get and set values in your .env file in local and production servers. ๐ŸŽ‰
  • Regex101 โ€” One of the second regular expression checkers.
  • re โ€” Regular expression operations.
  • sys โ€” System-specific parameters and functions.
  • time โ€” Time access and conversions.
  • typing โ€” Support for type hints.
  • urllib โ€” URL handling modules.
  • Visual Studio Code โ€” Code editing. Redefined.

Special Thanks

The following were the ones who inspired me and gave me confidence for making this pet project possible.

Other Resources

Keep in mind that most of these resources have been used for references and were not used for copy-pasting code! Also, it's worth noting that the links may be unsorted.

Articles or Guides

Questions (Unsorted)

Some of the questions here were snipped. They will redirect you to the answer.

Sites

I would like to thank those who asked and those who answered a particular question (for Questions), and to the repository and articles that describe the problem, which leads me to a certain direction, resulting in solving it.

License

  Copyright 2021 Janrey "CodexLink" Licas

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

You may see the LICENSE file for more information.

discord-activity-badge's People

Contributors

codexlink avatar dependabot[bot] avatar harleythetech avatar

Stargazers

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

Watchers

 avatar  avatar

discord-activity-badge's Issues

workflow failed when Processing Environment

I set everything up, but it always runs failed if though cron scheduling

ๅ›พ็‰‡

here are logs

2023-09-09T14:54:34.3156396Z [3045ms, INFO] at badge.py:269 -> Discord Client Task is done. Processing the badge...
2023-09-09T14:54:34.3157104Z [3045ms, INFO] at badge.py:295 -> Preferred Activity PreferredActivityDisplay.RICH_PRESENCE exists!
2023-09-09T14:54:34.3158415Z [3045ms, ERROR] at badge.py:669 -> Environment Processing has encountered an error. Please let the developer know about the following. | Info: 'details' at line 378.
2023-09-09T14:54:34.3253866Z ##[error]Environment Processing has encountered an error. Please let the developer know about the following. | Info: 'details' at line 378. | 
2023-09-09T14:54:34.4812515Z Cleaning up orphan processes

Left-out features awaiting for demand / left for a while to implement later

So far as I'm cleaning things out, I wanna list some features that I left out because (1) it may not be needed, (2) not a priority, (3) takes a while to implement, (4) not foreseeable to be used.

Keep note that some features are intended for developers only, because why not?

Here is the list of features:

  • Target Branch (latest version and future v1 only targets default branch)
  • Author and Committer Interchangeable Information.
  • HTML Tagline Coverage (Right now, the script only supports Markdown Elements)
  • Rate-Limit Aware.
  • Commit over Changes or Retain (The script keeps on committing, but we can include the fact that some states are constant unless user state changes.)
  • Commit Message with Date Formatting Support and Invoker.
  • Alert and Verbosity in action.yml (Those functionalities only exists when running the script in local)
  • Spotify Support and Extension
  • Time Display Customization (Implementation of Hours Only, Minutes Only, and Seconds Only)
  • Implementation of Commit Message with Time Distance with Recent Commit
  • Docker README Synchronization with Github Repository
  • Exception from Async Loop not being raised.

The list is not yet final and will update over time.

Unexpected Exceptions from AsyncIO Event Loop is not being raised.

Similarly from this case,

2021-08-10T18:20:11.7913286Z [2938ms, INFO] at badge.py:267 -> Discord Client Task is done. Processing the badge...
2021-08-10T18:20:11.7914778Z [2938ms, INFO] at badge.py:293 -> Preferred Activity PreferredActivityDisplay.RICH_PRESENCE does not exists. Using other activity such as CUSTOM_ACTIVITY.
2021-08-10T18:20:11.7936384Z Unclosed connector
2021-08-10T18:20:11.7937789Z connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x7f182638fa60>, 55.661981074)]']
2021-08-10T18:20:11.7938859Z connector: <aiohttp.connector.TCPConnector object at 0x7f18264b3a00>

Sometimes ClientSessions were closing the connection when it failed to process requests. This would normally happen when the container or the script was executed in a local device, so I'm looking forward to fixing it in the near future.

There will be a list of tasks here, but will show them as I decide what steps I should do later.

Refactorization Notice

Notice

I will start updating this on June 5 as the content of this notice is incomplete. This project has been overdue since the thesis hit me.
Currently passive-updating this issue.

Another Notice

Some checkmarks copy the task lists from the following issues: #5, #6, and #9.

Why

Sooner or later (By June or July [if I graduated on time]), I will be refactoring the whole thing with the same workflow parameters and with more options. With that being said, I wanted to refactor this because just from looking at it, it is over complicated OOP approach, which intrigues me over a simple integration to README.

What

This section contains subsections of components that will be refactored.

General

  • Logger with Styling
  • Argparse Polishing (For Local-Serve)
  • HTTP Module (being async)
  • Proper Typing (Python 3.10)
  • Programming Approach (Modular-OOP)
  • Redundancy Consolidation of File Declaration (see, elements)
  • Github Action Notification Context (Further Improve)
  • Unit Testing
  • HTTP or Markdown Detection

Issue-Related

#5

  • Identification of other states other than Spotify in API Reference of Discord.py
  • Test Case of Streaming State.

#6

  • Target Branch (latest version and future v1 only targets default branch)
  • Author and Committer Interchangeable Information.
  • HTML Tagline Coverage (Right now, the script only supports Markdown Elements)
  • Rate-Limit Awareness.
  • Commit over changes or retain (Check for potential refactorization in regards to scanning it first before building the badge)
  • Commit Message with Date Formatting Support. IDEA: Use datatime.strftime feature and formatting.
  • Alert and Verbosity in action.yml (Those functionalities only exist when running the script in local)
  • Spotify Support and Extension
  • Time Display Customization (Implementation of Hours Only, Minutes Only, and Seconds Only)
  • Implementation of Commit Message with Time Distance (UTC Offset) with Recent Commit
  • Docker README Synchronization with Github Repository (See recent up with the docker repository)

Badge (badges.py)

  • Interchangeable Badge Provider BADGEN | SHIELDS | CUSTOM (If custom provided, provide the elements that can be bound to the structure).
    -[ ]

HTTPs (http.py)

We may create a repository for this one due to its reusability.

CI/CD (Dockerfile and Github Actions related)

  • Further Optimize the Script (???)
  • Optimize Dockerfile layers. (Such as installing and other such)

Constants (constants.py)

  • Redefine types. (I'm quite uncomfortable using NewType)

Core (entrypoint.py)

  • Reduce complexity such as expensive setup due to instantiation of classes. (With this, we may need to do Async Class Instantiation, depending on the situation, and also depending on how I overview it.)
  • (At Startup) Do not explicitly convert provided data to certain data types, use Pydantic.
  • Exception from Async Loop is sometimes being raised and otherwise.

Logging (logging.py)

  • Adapt (folioblock's logging style)[https://github.com/CodexLink/folioblocks/blob/latest/node/utils/logger.py]. This depends on the uvicorn's custom logging, so we need to learn something on that.)

README

  • Reduce the sample badges of the header.
  • Create headers based on the unit testing.
  • Remove screenshots (due to privacy).
  • Optimize and ensure that the procedures are flawless.

Badge undetected when placed before other badges

image

The following image illustrates the duplication of the badge when the existing badge was placed before other badges. This is most likely a RegExp error. I haven't checked the log for this case.

SyntaxError: invalid syntax

[489ms, INFO] at utils.py:142 -> The logger has been loaded with Coverage Level 20. (INFO)
[489ms, INFO] at entrypoint.py:69 -> Running local mode invocation not detected. Skipping checks for '.env'.
[489ms, INFO] at utils.py:430 -> Environment Variables stored in-memory are successfully resolved!
[489ms, INFO] at api.py:61 -> ClientSession for API Requests has been instantiated.
[495ms, INFO] at api.py:64 -> Discord Client Instantiatied with intents=DISCORD_CLIENT_INTENTS=<Intents value=259>
[495ms, INFO] at api.py:68 -> AsyncGithubAPILite is done initializing other elements.
[496ms, INFO] at api.py:202 -> Attempting to Fetch README from Github API <<< IotaHydrae/IotaHydrae (https://api.github.com/repos/embeddedboys/NINJAR-lite/readme)
[497ms, INFO] at badge.py:265 -> Other non-important elements loaded, waiting for the Discord Client Task to finish before continuing...
[629ms, INFO] at api.py:129 -> Github Profile (embeddedboys/NINJAR-lite) README has been fetched. | Remaining Requests over Rate-Limit (978/1000)
[629ms, INFO] at badge.py:124 -> Converting README to a Readable Format...
[629ms, INFO] at badge.py:88 -> Conversion from Base64 (String) to Readable README Markdown Format is done and is loaded into the memory!
[630ms, INFO] at badge.py:138 -> Attempting to identify the badge inside README...
[630ms, INFO] at badge.py:157 -> Badge with Identifier ((Script) Discord Activity Badge) not found! New badge will append on the top of the contents of README.md. Please arrange/move the badge once changes has been pushed!
[630ms, INFO] at badge.py:166 -> Awaiting for the badge construction task to finish...
[2831ms, INFO] at client.py:77 -> Changed / Pushed Rich Presence to display Activity Badge#3890's status.
[2831ms, INFO] at client.py:108 -> Fetching Discord User's info...
[2955ms, INFO] at client.py:117 -> Discord User iotahydrae0 Fetched.
[2955ms, INFO] at client.py:151 -> Fetching mutual guild from the cached instance client...
[2955ms, INFO] at client.py:179 -> User iotahydrae#0 contains 1 activity.
[2955ms, INFO] at client.py:237 -> Step 2 of 2 | Finished fetching discord user's rich presence and other activities.
[2955ms, INFO] at client.py:90 -> Discord Client is finished fetching data and is saved for badge processing.
[2956ms, INFO] at client.py:95 -> Closing Sessions (1 of 2) | discord.Client -> Done.
[2956ms, INFO] at badge.py:269 -> Discord Client Task is done. Processing the badge...
[2956ms, INFO] at badge.py:295 -> Preferred Activity PreferredActivityDisplay.RICH_PRESENCE does not exists. Using other activity such as GAME_ACTIVITY.
[2956ms, INFO] at badge.py:654 -> The Badge URL has been generated. Link: [![(Script) Discord Activity Badge]([https://badgen.net/badge/Playing%20Game/%E7%BD%91%E6%98%93%E4%BA%91%E9%9F%B3%E4%B9%90%2C%2013%20minutes%20elapsed.?color=61d800&labelColor=00cd90&icon=discord)](https://github.com/embeddedboys/NINJAR-lite](https://badgen.net/badge/Playing%20Game/%E7%BD%91%E6%98%93%E4%BA%91%E9%9F%B3%E4%B9%90%2C%2013%20minutes%20elapsed.?color=61d800&labelColor=00cd90&icon=discord](https://github.com/embeddedboys/NINJAR-lite)))
Constructed? >  [![(Script) Discord Activity Badge]([https://badgen.net/badge/Playing%20Game/%E7%BD%91%E6%98%93%E4%BA%91%E9%9F%B3%E4%B9%90%2C%2013%20minutes%20elapsed.?color=61d800&labelColor=00cd90&icon=discord)](https://github.com/embeddedboys/NINJAR-lite](https://badgen.net/badge/Playing%20Game/%E7%BD%91%E6%98%93%E4%BA%91%E9%9F%B3%E4%B9%90%2C%2013%20minutes%20elapsed.?color=61d800&labelColor=00cd90&icon=discord](https://github.com/embeddedboys/NINJAR-lite)))
[2956ms, INFO] at badge.py:95 -> Conversion from README Readable Raw Content to a Base64 (Bytes) is done and is loaded into the variable for committing changes!
[2956ms, INFO] at badge.py:195 -> There are content changes with the recent README. Allowing to reflect changes!
[2956ms, INFO] at entrypoint.py:129 -> Done loading modules and necessary elements for the process.
[2956ms, INFO] at entrypoint.py:158 -> 2 task/s left to finish the runtime process.
[2956ms, INFO] at api.py:202 -> Attempting to Commit Changes of README from Github API >>> IotaHydrae/IotaHydrae (https://api.github.com/repos/embeddedboys/NINJAR-lite/contents/README.md)
[2957ms, INFO] at entrypoint.py:158 -> 3 task/s left to finish the runtime process.
[2957ms, INFO] at entrypoint.py:158 -> 2 task/s left to finish the runtime process.
[3245ms, INFO] at entrypoint.py:137 -> All tasks successfully finished! Closing Client Sessions...
[3245ms, INFO] at entrypoint.py:144 -> Connection Sessions were successfully closed. (Discord Client and Github API)
Task exception was never retrieved
future: <Task finished name='Task-22' coro=<AsyncGithubAPILite.exec_api_actions() done, defined at /app/api.py:72> exception=SyntaxError('invalid syntax', ('<unknown>', 1, 1, '<ClientResponse(https://api.github.com/repos/embeddedboys/NINJAR-lite/contents/README.md) [409 Conflict]>\n'))>
Traceback (most recent call last):
  File "/app/api.py", line 108, in exec_api_actions
    http_request: ClientResponse = await self._request(
  File "/app/api.py", line 257, in _request
    _resp_ctx: dict = literal_eval(str(_resp_raw))
  File "/usr/local/lib/python3.9/ast.py", line 62, in literal_eval
    node_or_string = parse(node_or_string, mode='eval')
  File "/usr/local/lib/python3.9/ast.py", line 50, in parse
    return compile(source, filename, mode, flags,
  File "<unknown>", line 1
    <ClientResponse(https://api.github.com/repos/embeddedboys/NINJAR-lite/contents/README.md) [409 Conflict]>
    ^
SyntaxError: invalid syntax

Investigate other activities that may represent UNSPECIFIED_ACTIVITY.

When there are other activities displayed by Discord, it is safe to assume that it should only be a Spotify Class. But I think there's more than that. I have to investigate since there are still some elements that I haven't recognized yet. Some actions such as Twitch seem to be another activity that may represent the UNSPECIFIED_ACTIVITY. So with that said, the following should be done:

  • - Identification of other states other than Spotify in API Reference of Discord.py
  • - Test Case of Streaming State.
  • - Code Patch.

This is expected to be done or is in progress if the development is in post-era.

Failure at Update Readme Discord Badge to latest Upstream

Hi! i tried running your discord badge but unfortunately it fails to run due to an error on "Update Readme Discord Badge to latest Upstream" can you help me fix this?

Err code:
`Run CodexLink/[email protected]
/usr/bin/docker run --name codexlinkdiscordactivitybadgelatest_f34f43 --label 08450d --workdir /github/workspace --rm -e INPUT_DISCORD_USER_ID -e INPUT_DISCORD_BOT_TOKEN -e INPUT_BADGE_IDENTIFIER_NAME -e INPUT_COMMIT_MESSAGE -e INPUT_PROFILE_REPOSITORY -e INPUT_URL_TO_REDIRECT_ON_CLICK -e INPUT_WORKFLOW_TOKEN -e INPUT_CUSTOM_ACTIVITY_STRING -e INPUT_GAME_ACTIVITY_STRING -e INPUT_RICH_PRESENCE_STRING -e INPUT_STREAM_ACTIVITY_STRING -e INPUT_SPOTIFY_ACTIVITY_STRING -e INPUT_ONLINE_STATUS_STRING -e INPUT_IDLE_STATUS_STRING -e INPUT_DND_STATUS_STRING -e INPUT_OFFLINE_STATUS_STRING -e INPUT_CUSTOM_ACTIVITY_COLOR -e INPUT_GAME_ACTIVITY_COLOR -e INPUT_RICH_PRESENCE_COLOR -e INPUT_STREAM_ACTIVITY_COLOR -e INPUT_SPOTIFY_ACTIVITY_COLOR -e INPUT_ONLINE_STATUS_COLOR -e INPUT_IDLE_STATUS_COLOR -e INPUT_DND_STATUS_COLOR -e INPUT_OFFLINE_STATUS_COLOR -e INPUT_STATIC_SUBJECT_STRING -e INPUT_PREFERRED_PRESENCE_CONTEXT -e INPUT_TIME_DISPLAY_OUTPUT -e INPUT_TIME_DISPLAY_ELAPSED_OVERRIDE_STRING -e INPUT_TIME_DISPLAY_REMAINING_OVERRIDE_STRING -e INPUT_TIME_DISPLAY_SHORTHAND -e INPUT_PREFERRED_ACTIVITY_TO_DISPLAY -e INPUT_SHIFT_STATUS_ACTIVITY_COLORS -e INPUT_SPOTIFY_INCLUDE_ALBUM_PLAYLIST_NAME -e INPUT_STATUS_CONTEXT_SEPERATOR -e INPUT_IS_DRY_RUN -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_RUN_ATTEMPT -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_REF_NAME -e GITHUB_REF_PROTECTED -e GITHUB_REF_TYPE -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e GITHUB_STEP_SUMMARY -e RUNNER_OS -e RUNNER_ARCH -e RUNNER_NAME -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/Harleythetech/Harleythetech":"/github/workspace" codexlink/discord-activity-badge:latest
[632ms, INFO] at utils.py:142 -> The logger has been loaded with Coverage Level 20. (INFO)
[632ms, INFO] at entrypoint.py:69 -> Running local mode invocation not detected. Skipping checks for '.env'.
[632ms, INFO] at utils.py:430 -> Environment Variables stored in-memory are successfully resolved!
[633ms, INFO] at api.py:61 -> ClientSession for API Requests has been instantiated.
[640ms, INFO] at api.py:64 -> Discord Client Instantiatied with intents=DISCORD_CLIENT_INTENTS=
[640ms, INFO] at api.py:68 -> AsyncGithubAPILite is done initializing other elements.
[643ms, INFO] at api.py:202 -> Attempting to Fetch README from Github API <<< Harleythetech/Harleythetech (https://api.github.com/repos/Harleythetech/Harleythetech/readme)
[643ms, INFO] at badge.py:265 -> Other non-important elements loaded, waiting for the Discord Client Task to finish before continuing...
[776ms, INFO] at badge.py:269 -> Discord Client Task is done. Processing the badge...
[866ms, INFO] at api.py:129 -> Github Profile (Harleythetech/Harleythetech) README has been fetched. | Remaining Requests over Rate-Limit (999/1000)
[867ms, INFO] at badge.py:124 -> Converting README to a Readable Format...
[868ms, INFO] at badge.py:88 -> Conversion from Base64 (String) to Readable README Markdown Format is done and is loaded into the memory!
[868ms, INFO] at badge.py:138 -> Attempting to identify the badge inside README...
[869ms, INFO] at badge.py:157 -> Badge with Identifier ((Script) Discord Activity Badge) not found! New badge will append on the top of the contents of README.md. Please arrange/move the badge once changes has been pushed!
[869ms, INFO] at badge.py:166 -> Awaiting for the badge construction task to finish...
Traceback (most recent call last):
File "/app/entrypoint.py", line 175, in
entry_instance: AbstractEventLoop = loop_instance.run_until_complete(
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
return future.result()
File "/usr/local/lib/python3.9/asyncio/tasks.py", line 690, in _wrap_awaitable
return (yield from awaitable.await())
File "/app/entrypoint.py", line 113, in start
data=[self.readme_data.result()[0], badge_updater.result()],
File "/app/badge.py", line 171, in check_and_update_badge
constructed_badge: BadgeStructure = self.badge_task.result()
File "/app/badge.py", line 271, in construct_badge
presence_ctx: dict[str, Any] = self.user_ctx[
AttributeError: 'DiscordActivityBadge' object has no attribute 'user_ctx'
Task exception was never retrieved
future: <Task finished name='DiscordClient_UserFetching' coro=<Client.start() done, defined at /usr/local/lib/python3.9/site-packages/discord/client.py:649> exception=LoginFailure('Improper token has been passed.')>
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/discord/http.py", line 300, in static_login
data = await self.request(Route('GET', '/users/@me'))
File "/usr/local/lib/python3.9/site-packages/discord/http.py", line 254, in request
raise HTTPException(r, data)
discord.errors.HTTPException: 401 Unauthorized (error code: 0): 401: Unauthorized

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/discord/client.py", line 665, in start
await self.login(*args, bot=bot)
File "/usr/local/lib/python3.9/site-packages/discord/client.py", line 511, in login
await self.http.static_login(token.strip(), bot=bot)
File "/usr/local/lib/python3.9/site-packages/discord/http.py", line 304, in static_login
raise LoginFailure('Improper token has been passed.') from exc
discord.errors.LoginFailure: Improper token has been passed.
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f74afed3340>
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f74b0b925e0>
Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x7f74afed42e0>, 385.992934199)]']
connector: <aiohttp.connector.TCPConnector object at 0x7f74aff71af0>
Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x7f74afe61d00>, 385.902341981)]']
connector: <aiohttp.connector.TCPConnector object at 0x7f74afed3c70>`

thank you!

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.