Skip to content

Commit

Permalink
Merge pull request #2 from RagnarLothbrok-Odin/v2
Browse files Browse the repository at this point in the history
V2
  • Loading branch information
RagnarLothbrok-Odin authored Dec 18, 2023
2 parents e20dfdc + f281249 commit a14e78a
Show file tree
Hide file tree
Showing 14 changed files with 4,396 additions and 307 deletions.
37 changes: 37 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
plugins: ['@typescript-eslint'],
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', require.resolve("eslint-config-airbnb/base")],
rules: {
'quotes': ['error', 'single'],
'object-curly-spacing': ['error', 'always'],
'import/prefer-default-export': 'off',
'indent': ['error', 4],
'no-console': 'off',
'max-len': [
'error',
{
ignoreComments: true,
code: 150,
ignoreUrls: true,
ignoreStrings: true,
ignoreTemplateLiterals: true
}
],
'class-methods-use-this': 'off',
'no-inner-declarations': 'off',
'import/extensions': 'off',
'consistent-return': 'off',
'import/no-unresolved': 'off',
'no-nested-ternary': 'off',
'no-unused-expressions': 'off',
'max-classes-per-file': 'off',
'no-use-before-define': 'off',
'no-throw-literal': 'off'
},
};
46 changes: 46 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Bug report
description: Create a report to help us improve
title: "[BUG] Short Description"
labels: bug
body:
- type: textarea
attributes:
label: Current Behavior
description: A clear and concise description of what you're experiencing. Do NOT combine multiple bugs into one issue. If you have multiple bugs to report please open separate issues for EACH bug.
validations:
required: true
- type: textarea
attributes:
label: Expected Behavior
description: A clear and concise description of what you expected to happen.
validations:
required: true
- type: textarea
attributes:
label: Steps To Reproduce
description: Steps to reproduce the behavior.
placeholder: |
1. Go to ...
2. Click on ...
3. Scroll to ...
4. See error ...
validations:
required: true
- type: textarea
attributes:
label: Screenshots and Additional Info
description: |
Provide any relevant additional information such as screenshots or other details here.
Tip: You can attach images files by clicking this area to highlight it and then dragging files in.
validations:
required: false
- type: checkboxes
attributes:
label: Checklist
description: Before submitting your bug report.
options:
- label: I have made a separate issue for each bug that I am reporting.
required: true
- label: I have searched the issues and this bug has not been reported.
required: true
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
35 changes: 35 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Feature request
description: Suggest an idea for this project
title: "[Feature] Short Description"
labels: enhancement
body:
- type: textarea
attributes:
label: Feature description
description: A clear and concise description of what you want to happen. Do NOT combine multiple feature requests into one issue. Open new issues for EACH request.
validations:
required: true
- type: textarea
attributes:
label: Why is this feature needed? Please justify and explain.
description: A clear and concise explanation justifying why this feature is needed. Ex. I'm always frustrated when [...]
validations:
required: true
- type: textarea
attributes:
label: Screenshots and Additional Info
description: |
Provide any relevant additional information such as screenshots or other details here.
Tip: You can attach images files by clicking this area to highlight it and then dragging files in.
validations:
required: false
- type: checkboxes
attributes:
label: Checklist
description: Before submitting your feature request.
options:
- label: I have made a separate issue for each feature I am requesting.
required: true
- label: I have searched the issues and this feature has not been requested.
required: true
28 changes: 28 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!--- Please provide a general summary of your changes in the title above -->

## Pull request type

<!-- Please try to limit your pull request to one type, submit multiple pull requests if needed. -->

Please check the type of change your PR introduces:

- [ ] Bugfix
- [ ] Feature

## What is the current behavior?

<!-- Please describe the current behavior that you are modifying, or link to a relevant issue. -->

Issue Number: N/A

## What is the new behavior?

<!-- Please describe the behavior or changes that are being added by this PR. -->

-
-
-

## Other information

<!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. -->
30 changes: 30 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Close stale issues and PRs
'on':
schedule:
- cron: 0 0 * * *
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v8
with:
days-before-stale: 30
days-before-close: 5
stale-issue-message: >-
This issue has been automatically flagged as stale due to a lack of
recent updates. It will be closed if no further activity is
observed. We appreciate your contributions.
stale-pr-message: >-
This pull request has been automatically flagged as stale due to a
lack of recent updates. It will be closed if no further activity is
observed. We appreciate your contributions.
close-issue-message: >-
This issue has been closed due to inactivity. Please feel free to
reopen if further action is required or additional information is
provided.
close-pr-message: >-
This pull request has been closed due to inactivity. Please feel
free to reopen if further action is required or additional
information is provided.
exempt-issue-labels: in-progress
exempt-pr-labels: in-progress
38 changes: 32 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,36 @@
# Irritating file create by Mac
# ========================
# System generated files
# ========================

# macOS generated files
.DS_Store

# Random stuff
node_modules/
yarn.lock
.eslintrc.json
# ========================
# Build output
# ========================

# Build directory
build/

# ========================
# IDEs and editors
# ========================

# JetBrains IDEs (e.g., WebStorm, IntelliJ)
.idea/

# ========================
# Dependency management
# ========================

# Yarn: lock file and error log
yarn-error.log
.yarn/
.pnp.cjs
.pnp.loader.mjs

# ========================
# Config file
config.json
# ========================
config.json

114 changes: 59 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,79 +1,83 @@
<a href="https://discord.gg/Q3ZhdRJ"><img src="https://img.shields.io/discord/495602800802398212?label=Discord&style=for-the-badge"/></a>
[![Codacy Badge](https://img.shields.io/codacy/grade/eb4d99a79b5c4151a7431b1cb1057e1b?style=for-the-badge)](https://www.codacy.com/gh/RagnarLothbrok-Odin/trakt-discord-presence/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=RagnarLothbrok-Odin/trakt-discord-presence&amp;utm_campaign=Badge_Grade)
![Repo Size](https://img.shields.io/github/languages/code-size/RagnarLothbrok-Odin/trakt-discord-presence.svg?style=for-the-badge)
![TOP_LANGUAGE](https://img.shields.io/github/languages/top/RagnarLothbrok-Odin/trakt-discord-presence.svg?style=for-the-badge)
![Stars](https://img.shields.io/github/stars/RagnarLothbrok-Odin/trakt-discord-presence.svg?style=for-the-badge)
![FORKS](https://img.shields.io/github/forks/RagnarLothbrok-Odin/trakt-discord-presence.svg?style=for-the-badge&social)
<a href="https://choosealicense.com/licenses/mit"><img src="https://img.shields.io/github/license/RagnarLothbrok-Odin/trakt-discord-presence.svg?style=for-the-badge"/></a>
<div align="center">
<br />
<br />
<p>
<a href="https://discord.gg/Q3ZhdRJ">
<img src="https://img.shields.io/discord/495602800802398212.svg?colorB=Blue&logo=discord&label=Support&style=for-the-badge" alt="Support">
</a>
<a href="https://github.com/RagnarLothbrok-Odin/TraktDiscordPresence">
<img src="https://img.shields.io/github/languages/top/RagnarLothbrok-Odin/TraktDiscordPresence.svg?style=for-the-badge" alt="Language">
</a>
<a href="https://github.com/RagnarLothbrok-Odin/TraktDiscordPresence/issues">
<img src="https://img.shields.io/github/issues/RagnarLothbrok-Odin/TraktDiscordPresence.svg?style=for-the-badge" alt="Issues">
</a>
<a href="https://github.com/RagnarLothbrok-Odin/TraktDiscordPresence/pulls">
<img src="https://img.shields.io/github/issues-pr/RagnarLothbrok-Odin/TraktDiscordPresence.svg?style=for-the-badge" alt="Pull Requests">
</a>
<a href="https://app.codacy.com/gh/RagnarLothbrok-Odin/TraktDiscordPresence/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade">
<img src="https://img.shields.io/codacy/grade/eb4d99a79b5c4151a7431b1cb1057e1b?style=for-the-badge" alt="Codacy Ranking">
</a>
</p>
</div>

# Trakt Discord Presence
Set your Discord presence according to what you are watching on [Trakt](https://trakt.tv/)

Due to Discord limitations, your Discord client **MUST** be running on the same device as this script.
Instantly stream your watching status on Discord courtesy [Trakt](https://trakt.tv/). Please note, due to certain
limitations on Discord, this script is required to run on the same device as your Discord client.

## Prerequisites
* [Node.js](https://nodejs.org)
* [Yarn](https://yarnpkg.com)
* [Trakt.tv Account](https://trakt.tv)
* [Discord Account](https://discord.com)
## Requirements

## Installation
1. [Download the latest release](https://github.com/RagnarLothbrok-Odin/trakt-discord-presence/releases)
* Extract the folder that was downloaded to your desired location using your preferred software, [WinRar for example](https://www.win-rar.com)
- [Node.js](https://nodejs.org)
- [Yarn](https://yarnpkg.com)
- [Trakt.tv](https://trakt.tv) & [Discord](https://discord.com) accounts

2. [Download Node.js](https://nodejs.org)
* `LTS` preferred, Current should work but `LTS` is recommended
* Ensure that `Node` is installed to `PATH`, it should be an option while installing
## Installation & Setup

3. [Install Yarn](https://classic.yarnpkg.com/en/docs/install)
* Open CMD/terminal/console on your device
* Run the following command
1. [Download](https://github.com/RagnarLothbrok-Odin/TraktDiscordPresence/releases), extract, and move the latest
release to your chosen location.

npm install --global yarn
* Point your CMD/terminal/console to the folder that you extracted the source to, by using the `cd` command, an example follows:
2. [Install Node.js](https://nodejs.org) (preferably the `LTS` version) and ensure `Node` is added to `PATH`.

cd /Users/ragnarlothbrok/Downloads/trakt-discord-presence
3. [Install Yarn](https://classic.yarnpkg.com/en/docs/install) globally, navigate to the source directory using the `cd`
command.
```Shell
npm install --global yarn
cd /path/to/your/extracted/source
```

4. Install the necessary packages with the following command:
4. Install packages using `yarn install`. A confirmation message appears upon successful installation.

yarn install
* A message will indicate when this step is completed
## App Configuration

## Setup
1. [Create your Trakt application](https://trakt.tv/oauth/applications)
* After clicking the above link, click `NEW APPLICATION`
* Set the `Name` as: `Discord`
* Set the `Redirect uri` as `urn:ietf:wg:oauth:2.0:oob`
1. [Create a new Trakt application](https://trakt.tv/oauth/applications), name it `Discord` and set `Redirect uri`
as `urn:ietf:wg:oauth:2.0:oob`.

2. [Create your Discord application](https://discord.com/developers/applications)
* After clicking the above link, click `New Application`
* Set the `NAME` as: `Trakt`
* Set the app icon by clicking the box under where it says `APP ICON` _(Set this image to the file named_ `trakt.png` _(you can find this file in the folder named_ `images` _in the extracted source)_
* Click `Rich Presence` on the left hand pane
* Set the cover image by clicking the box under where it say `Select Image` _(Set this image to the file named_ `trakt.png` _(you can find this file in the folder named_ `images` _in the extracted source)_
* Click `Add Image(s)` and upload the images you can find in the folder named `images` in the extracted source
2. [Create a new Discord application](https://discord.com/developers/applications), name it `Trakt` and
add `trakt.png` (available in `images` folder) as the app icon and as the cover image in `Rich Presence` section.
Upload the remaining images found in `images` folder.

## Usage
1. Run the program by running the following command:
## How to Use

yarn start
1. Run the program using `yarn start`.

2. You will be asked for your [Trakt Client ID](https://trakt.tv/oauth/applications), if you did not create an application, ensure you read the [Setup section of this page](https://github.com/RagnarLothbrok-Odin/trakt-discord-presence/blob/main/README.md#setup)
2. It prompts for [Trakt Client ID and Secret](https://trakt.tv/oauth/applications)
and [Discord Client ID](https://discord.com/developers/applications) (Refer to `App Configuration` section if not
already setup).

3. You will be asked for your [Trakt Client Secret](https://trakt.tv/oauth/applications)
3. It prompts for your preferred UI mode, either 'Progress Bar' or 'Standard Log' Examples of both outputs can be seen
at the bottom of this page.

4. You will be asked for your [Discord Client ID](https://discord.com/developers/applications), if you did not create an application, ensure you read the [Setup section of this page](https://github.com/RagnarLothbrok-Odin/trakt-discord-presence/blob/main/README.md#setup)
4. You're then provided a `URL`. Paste this onto any browser, retrieve the code and enter it in your terminal.
5. You will be provided a `URL`, you must paste this link into a browser of your choosing
* Once you visit this `URL`, a code will be provided, you must paste this code into your CMD/terminal/console

6. Finally, you must now run the following code to start the program.
5. Run `yarn start` to launch the program.
yarn start
If set up correctly, your output should resemble this:
## Functionality
If you follow all the steps correctly, you should see an output similar to the following
<img src="https://raw.githubusercontent.com/RagnarLothbrok-Odin/trakt-discord-presence/main/example.png">
- **Progress Bar**
</br><img src="https://share.valhalladev.org/u/progress_bar.png" alt="Progress Bar" style="width: 1000px;">
- **Standard Log**
</br><img src="https://share.valhalladev.org/u/standard_log.png" alt="Standard Log" style="width: 700px;">
## License
<a href="https://choosealicense.com/licenses/mit/"><img src="https://raw.githubusercontent.com/johnturner4004/readme-generator/master/src/components/assets/images/mit.svg" height=40 /></a>
Loading

0 comments on commit a14e78a

Please sign in to comment.