yugoccp / slack2discord

Slack2DiscordJS - a script to help you transfer Slack messages to Discord
19 stars 3 forks source link

Fix an issue: include and exclude properties from config file always overwritten and not used #29

Closed dmitry1100 closed 1 year ago

dmitry1100 commented 1 year ago

src/index.js had the following lines:

options.include = options.include ? options.include.split(',') : [];
options.exclude = options.exclude ? options.exclude.split(',') : [];

which make options.include and options.exclude defined as array. Later let's suppose that a config file has include and exclude defined. It is parsed:

  const configOptions = configFile ? JSON.parse(configFile) : {};

and later the following code merges both options from command line and from config:

  const { source, token, serverId, out, include, exclude, parentChannel, onlyParse } = {
    ...configOptions,
    ...options
  }

So, include/exclude from command line args always overwrite such properties from config file because they always defined even if not passed as args.

yugoccp commented 1 year ago

Thanks for PR @dmitry1100 !