Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

guild_ids refactor #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions aicord/__main__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
from __future__ import annotations

import asyncio

from dotenv import load_dotenv

load_dotenv()
from aicord.discord.bot import main


if __name__ == "__main__":
from aicord.discord.bot import main

load_dotenv()
try:
asyncio.run(main())

except KeyboardInterrupt:
pass
pass
2 changes: 0 additions & 2 deletions aicord/core/ai/summarize.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations

import logging
import os

Expand Down
5 changes: 4 additions & 1 deletion aicord/discord/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@

from aicord.discord.cogs import COGS


class BotConfig(TypedDict, total=False):
owner_ids: list[int]
owner_guild_ids: list[int]


class AicordBot(discord.Bot):
def __init__(self, config: BotConfig) -> None:
intents = discord.Intents.default()
Expand Down Expand Up @@ -41,4 +43,5 @@ async def main() -> None:
for cog in COGS:
bot.load_extension(cog.name)

await bot.start()
await bot.start()
print("Bot started.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In pycord docs we have an example with hook on how to log after bot start

2 changes: 1 addition & 1 deletion aicord/discord/cogs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
]
)

COGS = _cogs
COGS = _cogs
8 changes: 7 additions & 1 deletion aicord/discord/cogs/summarize.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,14 @@
class Summarize(commands.Cog):
def __init__(self, bot_: discord.Bot):
self.bot = bot_
if not os.environ.get('GUILD_IDS'):
guild_ids = None
else:
guild_ids = os.environ.get('GUILD_IDS')

summarize = SlashCommandGroup("summarize", description="Get a quick summary of what's going on in the server.", guild_ids=[994570645671268442,966090258104062023])
summarize = SlashCommandGroup("summarize",
description="Get a quick summary of what's going on in the server.",
guild_ids=guild_ids)

@staticmethod
async def load_chat(channel: discord.TextChannel, interval: str) -> list[discord.Message]:
Expand Down
1 change: 1 addition & 0 deletions aicord/discord/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import discord


def collect_participants(messages: list[discord.Message]) -> dict[int, str]:
participants = {}
for message in messages:
Expand Down