Coder Social home page Coder Social logo

hunteroi / discord-mailbox Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 14.6 MB

A simple framework to easily add a mailbox inside your bot with DiscordJS.

Home Page: https://hunteroi.github.io/discord-mailbox

License: MIT License

TypeScript 100.00%
discordjs bot mailbox modmail

discord-mailbox's Introduction

release version nb downloads npm

Discord Mailbox

Discord Mailbox is a framework to easily add a mailbox inside your bot. The feature is also fully customizable.

  • Supports multiple tickets per users
  • Logs everything like you want it
  • Emits events like ticketCreate, ticketUpdate and 8 more
  • Allow full customization of the embed (you can add image, thumbnail, etc)
  • And much more!

v3 example

See ./examples/index.js. If you want to try this example, you need to send createTicket in your bot's DM.

Prerequisites ⚠️

Starting at v2.0.0, you must use NodeJS v16.6.0 or higher to run a bot with this library.

You also must not forget to include mandatory intents and partials as well as give your bot the rights to read messages.

Mandatory intents and partials

  • GUILDS: used to access guild content such as channels.
  • GUILD_MESSAGES: used to read guild messages.
  • GUILD_MESSAGE_REACTIONS: used to access guild messages reactions.
  • DIRECT_MESSAGES: used to access direct messages to the bot.
  • CHANNEL: used to receive events when the bot is DMed.
  • MESSAGE: used to read the messages even if incomplete.

Installation

npm install --save @hunteroi/discord-mailbox

Events

manager.on(MailboxManagerEvents.ticketCreate, (ticket: Ticket) => {});

manager.on(MailboxManagerEvents.ticketUpdate, (ticket: Ticket) => {});

manager.on(MailboxManagerEvents.ticketLog, (ticket: Ticket) => {});

manager.on(MailboxManagerEvents.ticketClose, (ticket: Ticket) => {});

manager.on(MailboxManagerEvents.ticketForceClose, (ticket: Ticket, user: User | PartialUser) => {});

manager.on(MailboxManagerEvents.ticketDelete, (ticket: Ticket) => {});

manager.on(MailboxManagerEvents.replySent, (message: Message, answer: Message) => {});

manager.on(MailboxManagerEvents.replyDelete, (message: Message) => {});

manager.on(MailboxManagerEvents.threadCreate, (ticket: Ticket, thread: ThreadChannel) => {});

manager.on(MailboxManagerEvents.threadArchive, (ticket: Ticket, thread: ThreadChannel) => {});

Contribution

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Branch: git checkout -b patch/YourAmazingWork
  3. Commit your Changes: git commit -m 'Add some amazing work'
  4. Push to the Branch: git push origin patch/YourAmazingWork
  5. Open a Pull Request

discord-mailbox's People

Contributors

hunteroi avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

discord-mailbox's Issues

Embeds are not built in an understandable way

Using author fields to display information on the ticket, footer to contain IDs and description to contain both the message content and the author's name is not a straightforward manner to share information in an embed.

Rebuilding it in a more standardized way would be more effecient. For example:

  • using the author field to put the sender's username and discriminator and avatar would be great ;
  • the ticket ID can be put in a field under the description, and the last message ID can be too ;
  • the footer could be used to store less important information such as the name of the receiver guild and its ID.

Given a single guild, select menu should not appear

If the options only contain configuration for a single guild, the select menu component should not be used.

Globally, the options should be a key-value pair (key being the guild ID, value being the options for the guild) !!

Cannot be used in a bot that handles multiple guilds

The bot is configurable only for a single guild channel as mailbox. It means the feature would only work for a single guild on a bot that would be used for several.

It would be important for the future to handle several guilds with a pair of guild-mailbox channel:

type MailboxResolvable = TextChannel | VoiceChannel | Snowflake;

...
mailboxesPerGuild: Collection<GuildResolvable, MailboxResolvable>;

No respond.

Hello there! For some reason, it does not reply that a new modmail has opened when I send a message on my bot's dm. It's like it doesn't do anything even though I did check if I did any typos.
Also, can you give me your discord username so that I can add you? It will be easier to talk there. It's okay if you don't want to.

Update to DiscordJS v13

Updating this package to latest version of DiscordJS would permit the use of some new features like selects, context menus, buttons, threads and slash commands.

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.