Skip to content

osbytes/devy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Devy

codecov License

A developer focused discord bot written in go

How to Get Started

Install all go dependencies

go get ./...

Run the app

Copy .env.sample to .env and add secrets

cp .env.sample .env

Install godotenv

go install github.com/joho/godotenv/cmd/godotenv@latest

Run the following command to run the application.

godotenv -f .env go run cmd/bot/main.go

Stack

  • Go v1.17
  • Discord

How to Contribute

  • Fork the project
  • Push changes
  • Create a PR and add reveiwers

Note: If you grab an issue that is labled TODO, please delete the TODO comment.

How to Test on a Test Bot

Testing

If you are adding a test please make sure to delete any of the todo comment once you push your changes

// TODO Tests: GetFirstContributionYearByUsername // labels: tests func TestGetFirstContributionYearByUsername(t *testing.T) { } // TODO Tests: GetFirstContributionYearByUsername // labels: tests func TestGetFirstContributionYearByUsername(t *testing.T) { }

Test Naming

// function to test func (g *GithubService) GetContributionsByUsername() { // logic } // notice the naming for the main test for GetContributionsByUsername // the struct followed but a single underscore and the receiver method name func TestGithubService_GetContributionsByUsername(t *testing.T) { // test } // test modifiers are separated by a double underscore followed by what you are testing for func TestGithubService_GetContributionsByUsername__MultiYear(t *testing.T) { // test }

Mocking

Run the command below to mock all of your interfaces

Pull mockery docker image

docker pull vektra/mockery

Run this in devy, replace pwd with root pwd

docker run -v "$PWD":/src -w /src vektra/mockery --all

For in package

docker run -v "$PWD":/src -w /src vektra/mockery --all --inpackage

If you need to monkey patch or create pointer functions follow this convention

// keep the pointer functions at the top of the file var ( doSomethingF = doSomething ) // make sure in the implementation you call the pointer func GetContributionsByUsername() { something, err := doSomethingF(args) } // now you can mock that function func TestGetContributionsByUsername(t *testing.T) { doSomethingF = func(args) (something, error) { return something, err } }

Ideas

  • Forces you to change nick name to real name
  • Displays github data
  • Gives us newest fireship videos
  • Scrapes for new changes to certain lang's
  • Coding challenges and scoreboards
  • Maybe something with leetcode
  • New Job openings for those looking for a new job

Known Issues

Error displaying in console

YYYY/MM/DD hh:mm:ss error closing resp body

bwmarrin/discordgo#1028 golang/go#49366

About

Discord bot for dev hub discord channel

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages