Exiled-Team / DiscordIntegration

GNU General Public License v3.0
13 stars 37 forks source link

[BUG] Null value of syncedRoles properties #74

Closed CosmosZvezdo4kin closed 2 years ago

CosmosZvezdo4kin commented 2 years ago

Describe the bug The loadSyncedRoles function sets the properties of the syncedRoles variable to null if these properties are not specified in the config or their values are empty, which leads to errors when using the "di add user 76561198202269403@steam 219862538844635136" command.

An error has occurred while receiving data from 127.0.0.1:9000: TypeError: Cannot set properties of null (setting '76561198202269403@steam')

To Reproduce Steps to reproduce the behavior:

  1. Specify an empty value for the "user_id_to_discord_id" parameter in the "synced-roles.yml" config.
  2. Restart bot.
  3. Enter the command "di add user 76561198202269403@steam 219862538844635136".

Expected behavior The new value of parameter "user_id_to_discord_id" must be written in config "synced-roles.yml".

Server logs N/a

EXILED Version ("latest" is not a version): 3.2.1

Results of show plugins command in console: N/a

Additional context To solve this problem, you have to replace line syncedRoles = tempSyncedRoles; in file "discordIntegration.js" 273 with syncedRoles = {roleToGroup: tempSyncedRoles["roleToGroup"] ?? {}, userIdToDiscordId: tempSyncedRoles["userIdToDiscordId"] ?? {}};