Skip to content

Commit 3213b1a

Browse files
committed
Change prints to logging
1 parent 95ab2be commit 3213b1a

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/bot/cogs/misc.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from discord.ext import commands
22

3+
from ..log_setup import logger
34
from ..utils import utils as ut
45

56

@@ -23,7 +24,7 @@ async def ping(self, ctx):
2324
2425
@param ctx Context of the message
2526
"""
26-
print(f"ping: {round(self.bot.latency * 1000)}")
27+
logger.info(f"ping: {round(self.bot.latency * 1000)}")
2728

2829
await ctx.send(
2930
embed=ut.make_embed(

src/bot/main.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,24 +45,25 @@ def _prefix_callable(_bot: commands.Bot, msg: discord.Message):
4545
@bot.event
4646
async def on_ready():
4747
"""!
48-
function called when the bot is ready. emits the '[Bot] has connected' message
48+
function called when the bot is ready. Emits the '[Bot] has connected' message
4949
"""
50-
print(f'{bot.user.name} has connected')
5150

52-
logger.info(f"Bot has connected, active on {len(bot.guilds)} guilds")
53-
54-
print(f'Bot is connected to the following guilds:')
5551
print()
5652
member_count = 0
53+
guild_string = ""
5754
for g in bot.guilds:
58-
print(f"{g.name} - {g.id} - Members: {g.member_count}")
55+
guild_string += f"{g.name} - {g.id} - Members: {g.member_count}\n"
5956
member_count += g.member_count
60-
print()
57+
58+
logger.info(f"Bot '{bot.user.name}' has connected, active on {len(bot.guilds)} guilds:\n{guild_string}")
59+
6160
await bot.change_presence(
6261
activity=discord.Activity(type=discord.ActivityType.watching, name=f"{PREFIX}help"))
6362

6463
# LOADING Extensions
64+
# this is done in on_ready() so that cogs can fetch data from discord when they're loaded
6565
bot.remove_command('help') # unload default help message
66+
# TODO: Register your extensions here
6667
initial_extensions = [
6768
'.cogs.misc',
6869
'.cogs.help'

0 commit comments

Comments
 (0)