Skip to content

Latest commit

 

History

History
95 lines (70 loc) · 3.69 KB

File metadata and controls

95 lines (70 loc) · 3.69 KB

How to contribute

This document outlines some of the conventions on development workflow, commit message formatting, contact points and other resources to make it easier to get your contribution accepted.

Getting started

  • Fork the repository on GitHub.
  • Read the README.md for build instructions.
  • Play with the project, submit bugs, submit patches!

Bitbot's structure

Bitbot uses NamedTriggers as a basic type. NamedTriggers are located in the /bitbot directory, and belong to the bitbot package. They have 4 main components, and are declared as shown below:

var NewVarTrigger = NamedTrigger{ // This has to be an exported variable.
	ID: "NewVar", // Used to access the trigger.
	Help: "This trigger is here solely for demonstration purpose", // What the bot answers when "!help NewVar" is sent.
	Init: func() error {
		// This is _optional_. If the error returned is not nil, the trigger isn't registered.
		// Use this to do setup actions and one-time steps for triggers, such as database migrations.
		// Since multiple copies of a trigger may be instantiated, it is strongly suggested that init actions be idempotent
		return nil
	}
	Condition: func(irc *hbot.Bot, m *hbot.Message) bool {
		return true // If this function returns true, the Action is executed.
	},
	Action: func(irc *hbot.Bot, m *hbot.Message) bool {
		irc.Reply(m.Name) // For example purpose, look at the [hellabot documentation](https://pkg.go.dev/github.com/whyrusleeping/hellabot?tab=doc) for more.
		return true // The message is consumed, it is not passed to other triggers.
	},
}

If you do some complex string modifications, having a makeNewVarMessage(...) string function might be useful for testing purpose.

Also, the epeen and 8ball triggers are simple and good real life example.

Contribution flow

This is a rough outline of what a contributor's workflow looks like:

  • Create a topic branch from where you want to base your work. This is usually master.
  • Make commits of logical units and add test case if the change fixes a bug or adds new functionality.
  • Run tests and make sure all the tests are passed.
  • Make sure your commit messages are in the proper format (see below).
  • Push your changes to a topic branch in your fork of the repository.
  • Submit a pull request to the repo.

Thanks for your contributions!

Coding Style

The coding style suggested by the Golang community is used in this repository. See the style doc for details.

Format of the Commit Message

We follow a rough convention for commit messages that is designed to answer two questions: what changed and why. The subject line should feature the what and the body of the commit should describe the why.


store/localstore: add comment for variable declaration.

Improve documentation.

The format can be described more formally as follows:


subsystem: what changed
BLANK LINE
why this change was made
BLANK LINE
footer(optional)

The first line is the subject and should be no longer than 70 characters, the second line is always blank, and other lines should be wrapped at 80 characters. This allows the message to be easier to read on GitHub as well as in various git tools.

If the change affects more than one subsystem, you can use comma to separate them like util/codec,util/types:.

If the change affects many subsystems, you can use * instead, like *:.

For the why part, if no specific reason for the change, you can use one of some generic reasons like "Improve documentation.", "Improve performance.", "Improve robustness.", "Improve test coverage."


Auto-generated by gaocegege/maintainer on 2019-12-17.