GitCord
2 min read • January 23, 2021
Timeline
Transfered repository to DevingOnDiscord
I focused on developing something that would get the job done. That was really my only priority. I don't plan to contribute anymore to GitCord because there's really no need for me to.
Janaury 23rd, 2021
v0.1.0 unofficially releases
Janaury 23rd, 2021
Started development
Janaury 21st, 2021
Conceptialised idea
Janaury 19th, 2021
Useful links
I recently was sent an invite to a GitHub organisation and a Discord group known as «DevingOnDiscord». From my understanding, it's essentially a group of lads who use Discord to turn a profit with their software. Frankly, I've never really cared about making a profit from my service, but I decided to help out with some of the projects. One of those being GitCord.
GitCord is a Discord bot that allows people to search for repositories via GitHub's API. It's pretty simple. Written in TypeScript with Discord.js, it uses the /search/repositories
endpoint to query for results. It works not too far from the following:
- You call the command and provide a query (eg.
git!search user:doamatto
) - It takes your query and:
- encodes it as a URI using encodeURI(); and:
- inserts it into a request to GitHub's servers, providing the results needed to display the data and logging the query for later use
- The data provided by GitHub is then:
- parsed into an easy format (JSON, in this case),
- sliced to the top 5 results; and:
- scanned to mark forked repos.
- All the data is coagulated into a MessageEmbed(), or embed message, using data from:
- the data from step 3 in a list,
- the query in step 1 to remind you what you searched for; and:
- the parsed query in step 2 in the form of a search to see other results that were excluded.
Overall, there are some flaws with how the bot operates that may be addressed by current maintainers, such as missing types (with the infamous TSFixMe
as a placeholder) and rate limiting from not using a token. However, for the average person who might see the need to self-host a bot to search GitHub, this gets the job done easily.