Skip to content

Commit 81cf6d6

Browse files
committed
coretasks: better logs for custom commands execution
1 parent c4dfdd9 commit 81cf6d6

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

sopel/coretasks.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,18 @@ def _execute_perform(bot):
163163
# How did you even get this command, bot?
164164
raise Exception('Bot must be connected to server to perform commands.')
165165

166-
LOGGER.debug('{} commands to execute:'.format(len(bot.config.core.commands_on_connect)))
167-
for i, command in enumerate(bot.config.core.commands_on_connect):
166+
commands = bot.config.core.commands_on_connect
167+
count = len(commands)
168+
169+
if not count:
170+
LOGGER.info('No custom command to execute.')
171+
return
172+
173+
LOGGER.info('Executing %d custom commands.', count)
174+
for i, command in enumerate(commands, 1):
168175
command = command.replace('$nickname', bot.config.core.nick)
169-
LOGGER.debug(command)
176+
LOGGER.debug(
177+
'Executing custom command [%d/%d]: %s', i, count, command)
170178
bot.write((command,))
171179

172180

0 commit comments

Comments
 (0)