role_assigner

command module
v0.0.0-...-b8a6db2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2020 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Role Assigner

Discord bot for assign roles.

Presentation

I made this bot for assignating role on discord server.

Often, when you have a discord server, you want people to self asign roles but with out give them the right to manage roles.

This is exactly what this bot do.

You give him a message where the bot watchs reactions, and when someone add or remove an emote to the message, the bot add of remove the role to the user.

The link between roles and emotes is made with the roles.json file.

Usage

This bot isn't made to run on multiple server. (It can, but the configuration will be the same.)

Configure roles

You have to configure the roles.json file.
To do that, you can rename the roles.json.tpl file to roles.json and complete it.

The roles.json file must contain an object.
Keys are a string which is the emote name.
Values are a string which is the role name.

Example of roles.json file:

{
    "py": "python",
    "rs": "rustacean",
    "go": "gopher",
    "hs": "haskell",
    "kt": "kotlin"
}
Configure environment (and some other things)

You have to put you discord token in a .env file.
The .env.tpl file is here to help you complete it.

Presents variable in the .env file:

  • discord → This is the token of your bot.
  • channels → Channels id where messages are watched (separate by a comma then a space , .
  • messages → Messages id watched by the bot (serarate by a comma then a space , ). When reaction are added to that message, if it correspond to a role (defined in the roles.json file), then the role is added to the user which added the emote.

The order of channels and messages is important !
The message id 1 (index 0) must be in the channel id 1 (with the index 0). In the channels and messages variables.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL