@gh-bot/core

GitHub bot framework

Usage no npm install needed!

<script type="module">
  import ghBotCore from 'https://cdn.skypack.dev/@gh-bot/core';
</script>

README

@gh-bot/core: GitHub bot creation framework


Looking for a simpler way to create bots? Try @gh-bot/cli, which allows writing simple scripts that trigger on commands.


@gh-bot/core is a simple framework to allow bot creation on GitHub. You can let the bot respond to multiple events like this:

const bot = new GhBot(token, repo, github_secret);
bot.on('command', (command, ghBot) => {
        bot.comment("## Hello world!");
});
bot.on('push', (branch, ghBot) => {
        bot.comment("## Hello world!");
});
bot.listen(port);
  • port is port the bot listens on.
  • token is the GitHub access token of the bot
  • repo is an arry of repo owner and repo name, like ["gh-bot", "core"]
  • github_secret is the secret to use for the webhooks.

Migrating from botio

If you already having existing botio code and don't want to rewrite it for @gh-bot/cli, you can use @gh-bot/botio which provides the Bot.io API with a modern base.