devy

所属分类:自然语言处理
开发工具:GO
文件大小:86KB
下载次数:0
上传日期:2023-04-25 16:27:13
上 传 者sh-1993
说明:  开发中心不一致通道的不一致机器人程序
(Discord bot for dev hub discord channel)

文件列表:
.env.sample (90, 2023-04-26)
LICENSE (1097, 2023-04-26)
Procfile (18, 2023-04-26)
cmd (0, 2023-04-26)
cmd\bot (0, 2023-04-26)
cmd\bot\main.go (1763, 2023-04-26)
devy.svg (111106, 2023-04-26)
go.mod (892, 2023-04-26)
go.sum (40697, 2023-04-26)
internal (0, 2023-04-26)
internal\devy (0, 2023-04-26)
internal\devy\bot.go (937, 2023-04-26)
internal\devy\commands.go (11137, 2023-04-26)
internal\devy\handlers.go (2768, 2023-04-26)
internal\github (0, 2023-04-26)
internal\github\contributions.go (8750, 2023-04-26)
internal\github\contributions_test.go (20177, 2023-04-26)
internal\github\languages.go (2424, 2023-04-26)
internal\github\repositories.go (1777, 2023-04-26)
internal\github\service.go (1132, 2023-04-26)
pkg (0, 2023-04-26)
pkg\colors (0, 2023-04-26)
pkg\colors\colors.go (83, 2023-04-26)
pkg\date (0, 2023-04-26)
pkg\date\date.go (968, 2023-04-26)
pkg\date\date_test.go (1405, 2023-04-26)
pkg\env (0, 2023-04-26)
pkg\env\env.go (350, 2023-04-26)
pkg\infra (0, 2023-04-26)
pkg\infra\logging.go (540, 2023-04-26)
pkg\strs (0, 2023-04-26)
pkg\strs\strings.go (1023, 2023-04-26)
pkg\strs\strings_test.go (1139, 2023-04-26)
... ...

Devy

codecov License

A developer focused discord bot written in go ## How to Get Started Install all go dependencies ```sh go get ./... ``` ### Run the app Copy `.env.sample` to `.env` and add secrets ```sh cp .env.sample .env ``` Install [godotenv](https://github.com/joho/godotenv) ```sh go install github.com/joho/godotenv/cmd/godotenv@latest ``` Run the following command to run the application. ```sh 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 ```go // TODO Tests: GetFirstContributionYearByUsername // labels: tests func TestGetFirstContributionYearByUsername(t *testing.T) { } // TODO Tests: GetFirstContributionYearByUsername // labels: tests func TestGetFirstContributionYearByUsername(t *testing.T) { } ``` ### Test Naming ```go // 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 ```sh docker pull vektra/mockery ``` Run this in devy, replace pwd with root pwd ```sh docker run -v "$PWD":/src -w /src vektra/mockery --all ``` For in package ```sh docker run -v "$PWD":/src -w /src vektra/mockery --all --inpackage ``` If you need to monkey patch or create pointer functions follow this convention ```go // 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 ```sh YYYY/MM/DD hh:mm:ss error closing resp body ``` https://github.com/bwmarrin/discordgo/issues/1028 https://github.com/golang/go/issues/49366

近期下载者

相关文件


收藏者