Coder Social home page Coder Social logo

modmail's Introduction

WIP MODMAIL BOT

Still a work in progress, has no actual integration with the main bot at this point due to the main bot still being very much a work in progress.

Uses json for storage. If this is a problem, feel free to start a branch and write your own cache handler, alternatively use another bot.
Shouldn't require much setup, fill in the relevant fields in config.js, should be well commented.

I've tried refactoring some of the original code that I wrote initially in haste, but a lot of it's still very questionable and in need of rewriting/refactoring.
Contributions welcome.

Docker image

Highly recommend making a named volume for the storage

Create a named volume docker volume create ModmailStorage
Make sure to have a config.js ready to go, see the example file for a template
Start the container

docker run -d --name modmail \
-v /path/to/config.js:/modmail/config.js \
-v ModmailStorage:/modmail/modmail_cache \
navydotgif/modmail:latest

How to use

Install Node.js, at least v12, though I'd recommend at least 14 due to Discord.js requiring it in v13.

Run git clone https://github.com/GalacticBot/modmail.git

Run yarn install, alternatively npm install if you don't have yarn for some reason.

Rename config.example.js to config.js, open it and fill in the relevant values. The comments should explain what they are for. If something is unclear open an issue and I'll attempt to make it more clear.

At this point you'll probably notice you need to add 3 new categories. I'm planning on automating a part of the setup process, but for now this is how it be. Make those, add their IDs to the array.

I'd recommend getting PM2 or whatever you prefer for process management.
Start up the bot and if you did everything right it should boot up and just work. If something goes wrong submit an issue, alternatively if you know how to fix it, issue a pull request.

Commands

!reply - Sends a reply to the user.
!cannedreply - Sends a pre-written reply to the user.
Both of these can be used with !r and !cr respectively and both of them support the anon keyword to send an anonymous reply. The anon keyword has to be the first argument.
!modmail <user> <content> or !mm <user> <content> - Sends a modmail to a user, also supports the anon keyword. !mm anon @navy.gif#1998 Some content that is sent anonymously
!markread [user|channel] - Marks the thread read and moves the channel to the read category indicating that the mail doesn't warrant a response. Messages you've replied to are automatically marked read.
!markunread [user|channel] - Marks the thread unread.
!mmlogs <user> [page] - Shows user's past modmail.
!mmqueue - Shows users in queue.
!id [channel] - Get the target user ID for the modmail thread. Can be used without the channel argument in a modmail channel, outside of a modmail channel will return the user ID for the channel's target if available.

The bot has an !eval command which you can grant access to in the config file.

Creating canned/pre-written replies
Simple as using !cr create <name> <the reply content here>. Updating an existing entry is done by overwriting it.
To delete one, use !cr delete <name>

TODO LIST

Commands

  • !markunread - Marks a thread unread Added, works similar to !markread, both from a channel and with a channel/user argument
  • !refresh- Refresh threads (recreate channels and repopulate them if the channel was hidden/deleted due to overflow)
  • !reload - Unsure if needed, putting here just in case. Would restart the bot when ran.

Other

  • Display more specific information instead of just "User is in banland" (should reflect whether user is actually banned or otherwise in the appeals server.
  • Add something to display character count for messages, either command or an option to toggle.
  • Allow arbitrary order of anon and user arguments for !modmail command.

modmail's People

Contributors

dependabot[bot] avatar navy-gif avatar

Stargazers

 avatar

Watchers

 avatar  avatar

modmail's Issues

TypeError: Cannot read property 'children' of null

Hey!
I was trying to run the bot on a server and then this happened.
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'children' of null
at ChannelHandler.sweepChannels (/home/container/structure/ChannelHandler.js:214:50)
at listOnTimeout (internal/timers.js:555:17)
at processTimers (internal/timers.js:498:7)

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.