diff --git a/src/commands/modules/bind.js b/src/commands/modules/bind.js index 11304c8..f690407 100644 --- a/src/commands/modules/bind.js +++ b/src/commands/modules/bind.js @@ -15,6 +15,25 @@ class Bind extends Command { return false; } + static getChannelNames(server, string) { + let obj = {}; + const channelNames = (server.bind || []).forEach((id) => { + const channel = server.guild.channels.cache.get(id); + + if (channel && channel.name) { + obj[channel.name] = id; + } + + obj[id] = 'Channel Not Found'; + }); + + if (!channelNames || !channelNames.length) { + obj = [' No Channels Bound!']; + } + + return obj; + } + usage(input, server) { let usage = server.lang('bindusage.title'); let command = auth.command_char + this.command_name; @@ -22,12 +41,8 @@ class Bind extends Command { return input.response( CommentBuilder.create({ data: { - [usage]: [ - server.lang('bindusage.description', { - bound: server.bind.join(', '), - permit: server.bindPermit ? 'ON' : 'OFF', - }), - ], + [usage]: Bind.getChannelNames(server), + 'Auto permitting': [server.bindPermit ? 'Turned ON' : ' Turned OFF'], commands: { [command]: server.lang('bindusage.noargs'), [command + ' none']: server.lang('bindusage.none'), @@ -72,15 +87,20 @@ class Bind extends Command { } } - input.il8nResponse('bind.okay', { channels: server.bind.join(', ') }); - } else { - input.il8nResponse('bind.current', { bound: server.bind.join(', ') }); + let usage = server.lang('bindusage.title'); + let command = auth.command_char + this.command_name; + + input.response( + CommentBuilder.create({ + data: { + [usage]: Bind.getChannelNames(server), + }, + }), + ); } } onUserJoinedChannel({ channelState, member, server }) { - console.log(server.bind.join(' - ')); - // throw out these states if (!member.voice.channelID) return; if (!server.bind.includes(channelState.channelID)) return;