Integrate the GitHub API with the Discord Bot API

The S.S.S Project TM


I’ve been trying to make my bot S.S.S Helper#6059 to commit to Github Repos,
My bot uses the Discord.py Python Library and was trying to integrate the Github API (REST) with it so I can commit repos but then I found pipedream.

pipedream simplified integrating apps and overall API and connection between 3rd party services, but there was one problem… I don’t know how to use it.


FOR EXAMPLE

  • The Discord Bot listens to messages and fetches there ids, but how would that help in committing changes to the Github Repos ?

  • When The Workflow is tested it commits to the repo instantly without anything happening to the bot, why did I add the bot in the first place then ?

  • How do I make it so when a certain message is sent it commits it to the main path of the repo ?


What I’m Using


  Using Pipedream

    Outside Pipedream
  • Github API (REST)
  • Discord.py Python Library

- - - - - - - - - - - - - - - - S.S.S Helper#6059- - - - - - - - - - - - - - - -

- - - - - - - - - - - - - - - - - - - - - -1081991942918918174- - - - - - - - - - - - - - - - - - - - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - #The S.S.S Project - - - - - - - - - - - - - - - - - - - - - - - - - - - -


My Research

  • Step0: I had to start researching so I started looking at conversations regarding my topic on StackOverflow, I found multiple ones that were unhelpful and without context so I tried to look for other approaches.

  • Step1: I started looking for ways to completely Integrate a Github repo to a discord server.
    – I integrated a Github Webhook using a Discord Webhook and checked “send me everything”, then the webhook proceeded to send all updates and commits on a discord channel.

  • Step2: I looked for bots with similar commands that use the discord.py library and found SanicBot, a discord bot created for the Sanic FrameWork Discord server that is designed to make it easy to reference documentation and Github pulls and issues. I joined the Discord server for help but the bot creator had left, I got his user asyte.Rob#9627, then I tried to see who was committing most in the project a user known as tinoy1336 or Tinoy Thomas, later I found out he created another bot for the Python Discord Community, the person that last contributed to it was ChrisJL or ChrisLovering which had a description saying " Product Manager at @constructpm Admin and Core Dev at @python-discord." and had 2 organizations listed “@python-discord and @constructpm”, then I was looking for a way to contact them for help regarding the bot.

  • Step3: I started looking for ways to do this using the Discord.py Library, I then found out that Github uses an API for the repos called “REST” and started reading the Github Documentation on it, then I was looking for ways to integrate API into my discord.py file and saw someone using import requests to do it, but that wouldn’t work in my case.

  • Step4: I found a more none technical way to use the Github API with the discord bot using Pipedream.com’s “Integrate the GitHub API with the Discord Bot API” and filled out the bot token, connected the Github account and so on… then I did a test and deployed it. after that I came to another stand still and you can guess what happens next.

Hello @S.S.Scriptties,

I think you can use this tutorial as a reference for your usecase Speed Run #3 - Publish your Dev.to articles to your Github account - YouTube. The tutorial uses dev.to as a source and create a commit to github, you can change the source to discord instead?

1 Like

Hello @vunguyenhung, Sadly this was not helpful for my situation or I didn’t understand how I’d go about making it work with Discord, though I thank you so much for your attempt, it is very appreciated.


if you’d like specifics on how I did it for more insight :

  • First : I used the “Discord Bot” Integration, specifically speaking I used the “New Message in Channel” Integration, Then I proceeded to fill out the following:

-Discord Bot Account (Application Token and Nickname)

-Guild (Discord Server)

-Channels (channel that the messages will be listened on)

-Timer (Interval)

-Emit Messages as single (False)

-Name (New Message in Channel)


  • Second : Then I used The Github Integration Specifically “Create or update file contents” as to test the integrations, I filled out the following:

-Github Account (Connected and authorized)

-Repository (The Repository that will be edited)

-Path (The Path to the file that’ll be edited)

-File content (The contents of the file)

-Commit message (Pipedream - {{steps.trigger.context.workflow_name}} …)

-Branch (Default as Master branch)


  • Finally : I tested the Discord Bot integration using an event, then I tested the Github Integration and it instantly added the file, but thats not what I want … I want it to change files if a specific message is written within the channel. after testing it I deployed the workflow and clicked “run now”.