GithubHelp home page GithubHelp logo

gitnation / inviteroles Goto Github PK

View Code? Open in Web Editor NEW

This project forked from shimmermare/inviteroles

0.0 1.0 2.0 276 KB

A Discord bot to automatically give roles to users who joined through specific invite.

License: MIT License

Kotlin 99.56% Dockerfile 0.33% Shell 0.11%

inviteroles's Introduction

InviteRoles

Automatically grant roles to users who joined through specific invite.

Commands

You can specify invite as invite code or as a link. Role can be specified via mention or it's name (use "quotes" if role has whitespaces in the name). If specified by name, first role with that name will be used.

  • /ir will output information about the bot (e.g. version).

  • /ir settings will output current guild settings.

  • /ir settings reset will reset guild settings to default.

  • /ir settings <name> will output current setting value.

  • /ir settings <name> <value> will change setting value.

  • /ir invites will output invites with roles assigned.

  • /ir invites <invite> will output roles assigned to an invite.

  • /ir invites <invite> clear will remove all assigned roles from an invite.

  • /ir invites <invite> add <role> will assign role to an invite.

  • /ir invites <invite> remove <role> will remove role from an invite.

  • To change settings, use /ir settings <setting name> <value>.

  • /ir invite will print all invites with the role set.

  • To set role to invite, use /ir invite <invite code or link> <role mention or "role name in quotes">.

  • To delete invite, use /ir invite <invite code or link> remove.

  • If there is multiple roles/channels by the same name, the most recently created will be used. Prefer using mention in this case.

Notes

  • Sometimes bot will send a very important warning message into the system message channel. You can disable warnings in settings.
  • To setup invite role you need to have role with Manage Roles permission and that role must be higher than the one you giving with invite. In other words, Moderator can setup Member role, but can't Moderator role.
  • If invite expires or is revoked - it will be removed from bot settings as well.
  • If a role that is the only role if the invite is deleted - invite settings will be removed from bot.
  • If your server is very popular or you are extremely lucky, it can happen that two or more users join through different invites at the same time. Because Discord doesn't let you know who joined through which invite, all users in question will not receive roles and bot will send warning message. Thankfully, chances are small and situation is purely theoretical.

Hosting

You need bot account (How to create and invite bot account?) and Java 11. Bot requires Manage Server, Manage Roles, View Channels, Send Messages permissions to work. Start bot with java -jar InviteRoles-VERSION_HERE.jar and these arguments:

  • --token "your bot token here" - bot token.
  • --db "database_path_here.db" - SQLite database path.

You can stop bot by using stop console command.

Stack

  • Java 11 and Kotlin 1.3
  • Maven
  • JDA - Discord API binding
  • Mojang Brigadier - command parsing library
  • JOpt-Simple - argument parsing library
  • Logback - logging framework (slf4j implementation)
  • SQLite file-based database
  • JUnit 5 Jupiter and Mockito for testing

Contributions

All contributions are welcome. Code style is IntelliJ IDEA default.

inviteroles's People

Contributors

chug2k avatar robhrt7 avatar shimmermare avatar

Watchers

 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.