lighthouse-labs/discord-shift-swap

Allow use for multiple servers

Closed this issue · 0 comments

General Information

Summary

The way the bot was getting a channel ID was very specific to our staging Discord server. I changed the way the bot gets the channel to allow for use in more than one server.

Impact to Users

None, this is a code-quality issue.

Additional Information

An example of the new interactions.
Old way:

const tradeChannel = (client.channels.cache.get(process.env.TRADE));

New way:

const tradeChannel = (client.channels.cache.find(channel => channel.name === "shift-changes"));

This no longer uses a hard coded channel ID. Instead it uses the channel name shift-changes, which is what the channel name needed is called in all our Discord servers.