Giter VIP home page Giter VIP logo

civet-discord's Introduction

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. If the total output size is large, it will switch from inlined code to file attachments.

You can edit your messages after initial sending, and the bot its response. If you delete a message or edit it to remove all relevant code blocks, the bot will delete its response (and will no longer consider edits to that message).

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

civet-discord's People

Contributors

argeento avatar bbrk24 avatar edemaine avatar marcrock22 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.