Skip to content

Commit

Permalink
Change prints to logging
Browse files Browse the repository at this point in the history
  • Loading branch information
nonchris committed Sep 2, 2021
1 parent 95ab2be commit 3213b1a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/bot/cogs/misc.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from discord.ext import commands

from ..log_setup import logger
from ..utils import utils as ut


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

await ctx.send(
embed=ut.make_embed(
Expand Down
15 changes: 8 additions & 7 deletions src/bot/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,24 +45,25 @@ def _prefix_callable(_bot: commands.Bot, msg: discord.Message):
@bot.event
async def on_ready():
"""!
function called when the bot is ready. emits the '[Bot] has connected' message
function called when the bot is ready. Emits the '[Bot] has connected' message
"""
print(f'{bot.user.name} has connected')

logger.info(f"Bot has connected, active on {len(bot.guilds)} guilds")

print(f'Bot is connected to the following guilds:')
print()
member_count = 0
guild_string = ""
for g in bot.guilds:
print(f"{g.name} - {g.id} - Members: {g.member_count}")
guild_string += f"{g.name} - {g.id} - Members: {g.member_count}\n"
member_count += g.member_count
print()

logger.info(f"Bot '{bot.user.name}' has connected, active on {len(bot.guilds)} guilds:\n{guild_string}")

await bot.change_presence(
activity=discord.Activity(type=discord.ActivityType.watching, name=f"{PREFIX}help"))

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

0 comments on commit 3213b1a

Please sign in to comment.