Skip to content

Commit

Permalink
add some missing returns
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisdickinson committed Oct 3, 2024
1 parent b7c8998 commit 024c03b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export async function startDiscordClient(logger: Logger) {

const [username, pluginName] = plugin!.split(':')
if (!pluginName) {
await command.reply({ content: "Could not parse bot name. Use `username:botname` form; see `/manage-plugins list`.", ephemeral: true })
return await command.reply({ content: "Could not parse bot name. Use `username:botname` form; see `/manage-plugins list`.", ephemeral: true })
}

const channels = await addHandlerToChannel(username, pluginName, command.guild!.id, (channel as GuildTextBasedChannel).name)
Expand All @@ -222,16 +222,16 @@ export async function startDiscordClient(logger: Logger) {
const channel = command.options.getChannel('channel') || command.channel

if (!plugin) {
await command.reply({ content: "Plugin name is required", ephemeral: true })
return await command.reply({ content: "Plugin name is required", ephemeral: true })
}

if (!channel || channel.type !== ChannelType.GuildText) {
await command.reply({ content: "Could not infer channel name", ephemeral: true })
return await command.reply({ content: "Could not infer channel name", ephemeral: true })
}

const [username, pluginName] = plugin!.split(':')
if (!pluginName) {
await command.reply({ content: "Could not parse bot name. Use `username:botname` form; see `/manage-plugins list`.", ephemeral: true })
return await command.reply({ content: "Could not parse bot name. Use `username:botname` form; see `/manage-plugins list`.", ephemeral: true })
}

const channelName = (channel as GuildTextBasedChannel).name
Expand Down Expand Up @@ -270,12 +270,12 @@ export async function startDiscordClient(logger: Logger) {
const hosts = command.options.getString('hosts')

if (!plugin) {
await command.reply({ content: "Plugin name is required", ephemeral: true })
return await command.reply({ content: "Plugin name is required", ephemeral: true })
}

const [username, pluginName] = plugin!.split(':')
if (!pluginName) {
await command.reply({ content: "Could not parse bot name. Use `username:botname` form; see `/manage-plugins list`.", ephemeral: true })
return await command.reply({ content: "Could not parse bot name. Use `username:botname` form; see `/manage-plugins list`.", ephemeral: true })
}

const hostList = (hosts || '').split(',')
Expand Down

0 comments on commit 024c03b

Please sign in to comment.