Add VoiceRoleSync documentation; fix occasional error

This commit is contained in:
Noikoio 2018-08-18 12:44:57 -07:00
parent bbd6080afe
commit 3cf2e3284f
3 changed files with 21 additions and 1 deletions

View file

@ -26,6 +26,7 @@ namespace Noikoio.RegexBot.Module.VoiceRoleSync
// Gather data. // Gather data.
if (!(argUser is SocketGuildUser user)) return; // not a guild user if (!(argUser is SocketGuildUser user)) return; // not a guild user
var settings = GetState<GuildSettings>(user.Guild.Id); var settings = GetState<GuildSettings>(user.Guild.Id);
if (settings == null) return; // not enabled here
var deafened = after.IsDeafened || after.IsSelfDeafened; var deafened = after.IsDeafened || after.IsSelfDeafened;
var (settingBefore, settingAfter) = settings.GetChannelSettings(before.VoiceChannel, after.VoiceChannel); var (settingBefore, settingAfter) = settings.GetChannelSettings(before.VoiceChannel, after.VoiceChannel);

View file

@ -31,3 +31,4 @@ The following is a list of accepted members within a server definition.
* [EntryAutoRole](entryautorole.html) - See respective page. * [EntryAutoRole](entryautorole.html) - See respective page.
* [ModCommands](modcommands.html) - See respective page. * [ModCommands](modcommands.html) - See respective page.
* [ModLogs](modlogs.html) - See respective page. * [ModLogs](modlogs.html) - See respective page.
* [VoiceRoleSync](voicerolesync.html) - See respective page.

18
docs/voicerolesync.md Normal file
View file

@ -0,0 +1,18 @@
## VoiceRoleSync
VoiceRoleSync directs the bot to apply specific roles to users when they are listening in to a voice channel.
Sample within a [server definition](serverdef.html):
```
"VoiceRoleSync": {
//"1000001::General": "1000002::In General VC",
//"1000003::Video Games": "1000004::In Gaming VC"
"1000001": "1000002",
"1000003": "1000004"
}
```
### Definition structure
A list of voice channels and their respective roles are defined in a `VoiceRoleSync` object. They are defined as JSON properties, with the name portion (before the colon) representing the voice channel and the value portion (after the colon) representing the role to be associated.
At the moment, only voice channel and role ID values are accepted in this configuration. EntityList-like names will be supported at a later date.