Update main. Add db and guild attributes. Add reload_cog command
This commit is contained in:
parent
745c3a9202
commit
47896ecac7
14
__main__.py
14
__main__.py
|
|
@ -28,14 +28,14 @@ class FunkyBot(commands.Bot):
|
|||
intents=bot_intents
|
||||
)
|
||||
self.log_handler = BotLog("bot.log")
|
||||
self.db = Db(db_conn_str, True)
|
||||
self.guild = None
|
||||
self.db = Db(db_conn_str, False)
|
||||
self.guild_id = guild_id
|
||||
self.guild = None
|
||||
self.dev_mode = dev_mode == "1"
|
||||
|
||||
async def on_ready(self):
|
||||
print(f"Logged in as {self.user.name}")
|
||||
self.guild = await Guilds().get_guild(self)
|
||||
self.guild = Guilds().get_guild(self)
|
||||
await self.tree.sync(guild=self.guild)
|
||||
|
||||
async def async_cleanup(self):
|
||||
|
|
@ -61,7 +61,7 @@ class FunkyBot(commands.Bot):
|
|||
if role is not None:
|
||||
if role not in member.roles:
|
||||
await member.add_roles(role)
|
||||
await channel.send(f"Another Penguin has joined the Collective. Everyone say hi to {member.mention}!")
|
||||
await channel.send(f"{role.mention} Another Penguin has joined the Collective. Say hi to {member.mention}!")
|
||||
|
||||
async def load_cogs(self):
|
||||
for filename in os.listdir("./cogs"):
|
||||
|
|
@ -69,6 +69,12 @@ class FunkyBot(commands.Bot):
|
|||
await self.load_extension(f"cogs.{filename[:-3]}")
|
||||
print(f"Loaded {filename[:-3]}")
|
||||
|
||||
@commands.command()
|
||||
async def reload_cog(self, ctx, cog):
|
||||
ctx.message.delete()
|
||||
await self.reload_cog(ctx, f"cogs.{cog}")
|
||||
print(f"Reloaded {cog}")
|
||||
|
||||
|
||||
async def main():
|
||||
bot = FunkyBot()
|
||||
|
|
|
|||
Loading…
Reference in a new issue