8000 GitHub - bbrk24/civet-discord: Discord bot
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

bbrk24/civet-discord

 
 

Repository files navigation

Civet Discord bot

This is Discord bot that transpiles Civet code into TypeScript or JavaScript.

Usage

The bot automatically responds to messages containing ``` code blocks with languages of

  • ```civet: regular Civet code, converted to TypeScript and Prettified.
  • ```coffee: CoffeeScript-compatibility mode: automatically prepend "civet coffeeCompat".
  • ```civet-raw or ```coffee-raw: Don't run Prettier; give the raw output from the Civet transpiler.
  • ```civet-js or ```coffee-js: Ask Civet to convert to JavaScript instead of TypeScript.
  • ```civet-raw-js or ```coffee-raw-js: Ask Civet to convert to JavaScript instead of TypeScript, and don't run Prettier.

You can include multiple code blocks, and you can edit your messages after initial sending, and the bot will update accordingly.

In addition, you can use the /civet slash command to transpile Civet code, with similar options. If you set the private option to True, you will get a private response, and not clutter the channel you are in.

Installation

Creating a Bot

Building and Running the Bot

  • Use Node >= 18
  • Create an .env file like .env.example:
    DISCORD_TOKEN=your-long-token
  • pnpm install
  • pnpm build to produce dist/index.js
  • pnpm start or node dist/index.js to start bot
  • Whenever the process is running, the bot is up

Running a Long-Term Bot

To permanently run the bot in the background, we recommend pm2:

  • npm install pm2@latest -g
  • pm2 startup (and follow instructions)
  • To run the bot and automatic upgrading of Civet: pm2 start bot.config.js
  • To run just the bot: pm2 start bot.config.js --only civet-discord
  • Restart the bot (e.g., when updating the bot): pm2 restart civet-discord

About

Discord bot

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%
0