Code Monkey home page Code Monkey logo

github-issues-discord-threads-bot's Introduction

Managing GitHub Issues via Discord Threads

This Discord bot serves as a seamless bridge between Discord thread channel and GitHub repository issues, enabling efficient issue management and synchronization between the two platforms. This integration allows for efficient project management, ensuring that actions performed on either Discord or GitHub are reflected in both platforms, facilitating smoother collaboration and issue tracking across teams.

Functionality Overview

Issues

  • Discord Post Creation -> Automatically generates a corresponding GitHub issue.
  • GitHub Issue Creation -> Pending feature: Creation of Discord posts from GitHub issues.

Comments

  • Discord Post Comments -> Mirrored as comments on associated GitHub issues.
  • GitHub Issue Comments -> Pending feature: Synchronization with Discord post comments.

Tags & Labels

  • Discord Post Tags -> Translated into GitHub issue labels for better categorization.
  • Discord Post Tag Changes -> Future implementation: Update GitHub issue labels from Discord.
  • GitHub Issue Label Changes -> Future implementation: Reflect changes in Discord post tags from GitHub.

Locking & Unlocking

  • Discord Post Lock/Unlock -> Corresponding action on GitHub issues for security or access control.
  • GitHub Issue Lock/Unlock -> Syncing locking status with Discord posts.

Open/Close Management

  • Discord Post Open/Close -> Triggers opening or closing of related GitHub issues.
  • GitHub Issue Open/Close -> Update Discord post status based on GitHub issue status.

Deletion Actions

  • Discord Post Deletion -> Initiates the removal of the associated GitHub issue.
  • GitHub Issue Deletion -> Sync deletion actions from GitHub to Discord posts.

Attachment Support

  • Supported File Types: png, jpeg
  • Planned Support: gif, text, video

Installation Steps

Creating bot

Create bot https://discord.com/developers/applications?new_application=true

Bot settings:

  • PRESENCE INTENT
  • MESSAGE CONTENT INTENT

Invite url: https://discord.com/api/oauth2/authorize?client_id=APPLICATION_ID&permissions=0&scope=bot

env

  • DISCORD_TOKEN - Discord developer bot page "Settings->bot->reset token" (https://discord.com/developers/applications/APPLICATION_ID/bot)
  • DISCORD_CHANNEL_ID - In the Discord server, create a forum channel and right-click (RMB) to copy the channel ID (developer settings must be turned on for this). Alternatively, you can copy the ID from the link. Example: https://discord.com/channels/<GUILD_ID>/<DISCORD_CHANNEL_ID>
  • GITHUB_ACCESS_TOKEN
    1. New Fine-grained Personal Access Token or follow these steps: Settings -> Developer settings -> Personal access tokens -> Fine-grained tokens -> Generate new token.
    2. In the "Repository access" section, select "Only select repositories" and choose the specific repositories you need access to.
    3. In the "Permissions" section, click on "Repository permissions" and set "Issues" to "Read & Write".
    4. Generate and copy the personal access token.
  • GITHUB_USERNAME - example: https://github.com/<GITHUB_USERNAME>/<GITHUB_REPOSITORY>
  • GITHUB_REPOSITORY

NOTE: For detailed information about personal access tokens, visit the Managing your personal access tokens - GitHub Docs.

Start bot

npm run dev

or

npm run build && npm run start

Forward for github webhooks:

ssh -R 80:localhost:5000 serveo.net

github-issues-discord-threads-bot's People

Contributors

holmityd avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

github-issues-discord-threads-bot's Issues

Documentation improvement

Hey!

I like your job ๐Ÿ‘ However, when I tried using this bot, I struggled a little bit when setting the personnal access token up.

I tried opening a pull request with an update on the main README file, but I wasn't allowed to do it, so I figured I could tell you about it in this isssue.

This is what I wanted to add in the README (at the end of the env section):

> **NOTE:**  
> As the bot uses the GitHub API, the Personnal Access Token (or PAS) will have to be "Fine-grained".
>
> Also, make sure you let the token have administrator rights on the repo you want to set the bot up on, otherwise the deletion of a forum post will cause it to crash.

Which outputs as:

NOTE:
As the bot uses the GitHub API, the Personnal Access Token (or PAS) will have to be "Fine-grained".

Also, make sure you let the token have administrator rights on the repo you want to set the bot up on, otherwise the deletion of a forum post will cause it to crash.


Related to the addition in the README, do you plan to catch exceptions on calls to GitHub or Discord APIs (at least in production mode), so that it doesn't necessarily crash when a request fails?
If you need help for that, I'd be glad to take part in the development process ๐Ÿ˜ƒ

Custom Tag

Great repo! Thanks a lot, I was able to set it up with no issues.

I have a question around tags. I would love for all issues in Github that were created from this bot to have a unique tag (something like "Discord" -- note that's not a discord tag).

How would you recommend to add that functionality?

Thank you

Channel ID not being read from .env : Ubuntu Oracle Cloud hosted service

Hi,

Thanks for writing this up, much appreciated.

I've managed to get this working on a free Oracle Cloud VM. Unfortunately on npm run dev I get the error below. It appears to be trying to use a different channel ID to the one I input to the config file - even changing it to a dummy value has it revert to the channel ID below. I have tried to search for references to the channel ID below but no luck.

Server is running on port 5000
06-09 16:19:25 Logged in as GitHubIssues#6541!
06-09 16:19:25 Issues loaded : 7
/home/ubuntu/discordBot/node_modules/@discordjs/rest/src/lib/handlers/Shared.ts:148
                        throw new DiscordAPIError(data, 'code' in data ? data.code : data.error, status, method, url, requestData);
                              ^


DiscordAPIError[10003]: Unknown Channel
    at handleErrors (/home/ubuntu/discordBot/node_modules/@discordjs/rest/src/lib/handlers/Shared.ts:148:10)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at SequentialHandler.runRequest (/home/ubuntu/discordBot/node_modules/@discordjs/rest/src/lib/handlers/SequentialHandler.ts:417:20)
    at SequentialHandler.queueRequest (/home/ubuntu/discordBot/node_modules/@discordjs/rest/src/lib/handlers/SequentialHandler.ts:169:11)
    at _REST.request (/home/ubuntu/discordBot/node_modules/@discordjs/rest/src/lib/REST.ts:210:20)
    at async ChannelManager.fetch (/home/ubuntu/discordBot/node_modules/discord.js/src/managers/ChannelManager.js:123:18) {
  requestBody: { files: undefined, json: undefined },
  rawError: { message: 'Unknown Channel', code: 10003 },
  code: 10003,
  status: 404,
  method: 'GET',
  url: 'https://discord.com/api/v10/channels/1249342558606332075'

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.