Skip to content

Commit

Permalink
Use channel mentions instead of channel IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
eibex committed Jan 28, 2020
1 parent 5c1ccec commit 4830607
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .version
@@ -1 +1 @@
0.0.4
0.0.5
12 changes: 7 additions & 5 deletions README.md
Expand Up @@ -80,10 +80,10 @@ Initiate the message creation process with `rl!new`.
User: rl!new
```

Next, you will be asked to provide the ID of the channel you want to send the message in. You can find the ID by right clicking the channel and clicking on `Copy ID`. If you do not see a `Copy ID` option, go to `Discord Settings > Appearance` and, at the bottom of the page, turn `Developer Mode` ON.
Next, you will be asked to mention the channel you want to send the message in.
```
Bot: Please paste the channel ID where to send the auto-role message.
User: 595907369242722304
Bot: Please mention the #channel where to send the auto-role message.
User: #get-roles
```

Next, you will be asked to attach emojis to roles. Only use standard emojis or those that are hosted on your server (i.e. the Bot is not a Nitro user and cannot use emojis from other servers). Send a single message for each single combination and then type `done` when you have finished attaching emojis to their respective roles. Ensure that the roles are mentionable when you are doing this step. You can disable mentions after finishing this step.
Expand All @@ -107,9 +107,11 @@ User: Select your roles // Click on the buttons below to give yourself some role
Finally, the bot will send the message to the channel specified in the first step, and it will react with each reactions specified so that the buttons are ready to be used. The bot will remove any new reactions to the message to avoid clutter. For example, if you added an `:eggplant:` reaction to the message created in this example, the bot will remove it as it is not attached to any role.

#### Editing
To edit an old embed and preserve the emoji-role links, you can use the `edit` command. You will need the channel and message id where the embed is located. You can find these IDs by right clicking the respective channel and messages (with developer mode on in your Discord settings). For example:
To edit an old embed and preserve the emoji-role links, you can use the `edit` command. You will need the message id where the embed is located. You can find these IDs by right clicking the respective channel and messages. You can find the ID by right clicking the channel and clicking on `Copy ID`. If you do not see a `Copy ID` option, go to `Discord Settings > Appearance` and, at the bottom of the page, turn `Developer Mode` ON.

For example:
```
rl!edit CHANNEL_ID // MESSAGE_ID // New Title // New Description
rl!edit #channelname // MESSAGE_ID // New Title // New Description
```

Any admin can edit old embeds, even if they were originally created by another admin.
Expand Down
10 changes: 5 additions & 5 deletions bot.py
Expand Up @@ -11,7 +11,7 @@

# Original Repository: https://github.com/eibex/reaction-light
__author__ = "eibex"
__version__ = "0.0.4"
__version__ = "0.0.5"
__license__ = "MIT"

directory = path.dirname(path.realpath(__file__))
Expand Down Expand Up @@ -109,7 +109,7 @@ async def on_message(message):
msg = message.content.split()
if step is not None: # Checks if the setup process was started before.
if step == 1: # If it was not, it ignores the message.
rlightfm.step1(r_id, msg[0])
rlightfm.step1(r_id, message.channel_mentions[0].id)
await message.channel.send(
"Attach roles and emojis separated by a space (one combination per message). When you are done type `done`. Example:\n:smile: `@Role`"
)
Expand Down Expand Up @@ -197,7 +197,7 @@ async def new(ctx):
if isadmin(ctx):
rlightfm.listen(ctx.message.author.id, ctx.message.channel.id)
await ctx.send(
"Please paste the channel ID where to " "send the auto-role message."
"Please mention the #channel where to send the auto-role message."
)
else:
await ctx.send("You do not have an admin role.")
Expand All @@ -219,10 +219,10 @@ async def edit_embed(ctx):
msg = ctx.message.content.split(" // ")
if len(msg) < 4:
await ctx.send(
"Formatting is: `Channel ID // Message ID // New Title // New Content`"
"Formatting is: `#channelname // Message ID // New Title // New Content`"
)
return
ch_id = int(sub("[^0-9]", "", msg[0]))
ch_id = ctx.message.channel_mentions[0].id
old_id = int(msg[1])
try:
ch = bot.get_channel(ch_id)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -3,7 +3,7 @@

# Original Repository: https://github.com/eibex/reaction-light
print("Author: eibex")
print("Version: 0.0.4")
print("Version: 0.0.5")
print("License: MIT\n")

print("### ### Reaction Light Setup ### ###")
Expand Down

0 comments on commit 4830607

Please sign in to comment.