Merge pull request 'v0.1.0' (#20) from dev into main

Reviewed-on: #20
This commit is contained in:
Profitroll 2024-12-27 23:38:13 +02:00
commit b9aeaf5c86
7 changed files with 27 additions and 15 deletions

View File

@ -10,7 +10,7 @@
## Installation from release ## Installation from release
1. Install MongoDB using the [official installation manual](https://www.mongodb.com/docs/manual/installation) 1. Install MongoDB using the [official installation manual](https://www.mongodb.com/docs/manual/installation)
2. Install Python 3.9+ (3.11+ is recommended) 2. Install Python 3.11+
3. Download the [latest release](https://git.end-play.xyz/HoloUA/Discord/releases/latest)'s archive 3. Download the [latest release](https://git.end-play.xyz/HoloUA/Discord/releases/latest)'s archive
4. Extract the archive 4. Extract the archive
5. Navigate to the extracted folder and subfolder `Discord` in it 5. Navigate to the extracted folder and subfolder `Discord` in it
@ -19,14 +19,14 @@
7. Activate the virtual environment: 7. Activate the virtual environment:
Windows: `.venv\Scripts\activate.bat` Windows: `.venv\Scripts\activate.bat`
Linux/macOS: `.venv/bin/activate` Linux/macOS: `.venv/bin/activate`
8. Install dependencies: 8. Install the dependencies:
`python -m pip install -r requirements.txt` `python -m pip install -r requirements.txt`
9. Run the bot with `python main.py` after completing the [configuration](#Configuration) 9. Run the bot with `python main.py` after completing the [configuration](#Configuration)
## Installation with Git ## Installation with Git
1. Install MongoDB using the [official installation manual](https://www.mongodb.com/docs/manual/installation) 1. Install MongoDB using the [official installation manual](https://www.mongodb.com/docs/manual/installation)
2. Install Python 3.9+ (3.11+ is recommended) 2. Install Python 3.11+
3. Clone the repository: 3. Clone the repository:
`git clone https://git.end-play.xyz/HoloUA/Discord.git` `git clone https://git.end-play.xyz/HoloUA/Discord.git`
4. `cd Discord` 4. `cd Discord`

View File

@ -1,4 +1,5 @@
import logging import logging
from logging import Logger
from typing import Any, Dict from typing import Any, Dict
from bson import ObjectId from bson import ObjectId
@ -8,7 +9,7 @@ from libbot.utils import config_get
from errors import UserNotFoundError from errors import UserNotFoundError
from modules.database import col_warnings, sync_col_users, sync_col_warnings, col_users from modules.database import col_warnings, sync_col_users, sync_col_warnings, col_users
logger = logging.getLogger(__name__) logger: Logger = logging.getLogger(__name__)
class HoloUser: class HoloUser:
@ -123,8 +124,3 @@ class HoloUser:
return True return True
return False return False
# def purge(self) -> None:
# """Completely remove data from database. Will not remove transactions logs and warnings."""
# col_users.delete_one(filter={"_id": self.db_id})
# self.unauthorize()

View File

@ -1,5 +1,6 @@
import logging import logging
import sys import sys
from logging import Logger
from discord import ( from discord import (
ApplicationContext, ApplicationContext,
@ -20,7 +21,7 @@ from modules.scheduler import scheduler
from modules.utils_sync import guild_name from modules.utils_sync import guild_name
from modules.waifu_pics import waifu_pics from modules.waifu_pics import waifu_pics
logger = logging.getLogger(__name__) logger: Logger = logging.getLogger(__name__)
class Admin(commands.Cog): class Admin(commands.Cog):

View File

@ -1,4 +1,5 @@
import logging import logging
from logging import Logger
from typing import Dict, List, Any from typing import Dict, List, Any
from discord import Cog, Message from discord import Cog, Message
@ -7,7 +8,7 @@ from discord.ext import commands
from classes.holo_bot import HoloBot from classes.holo_bot import HoloBot
from modules.database import col_analytics from modules.database import col_analytics
logger = logging.getLogger(__name__) logger: Logger = logging.getLogger(__name__)
class Analytics(commands.Cog): class Analytics(commands.Cog):

View File

@ -1,4 +1,5 @@
import logging import logging
from logging import Logger
from typing import Any, Dict from typing import Any, Dict
from discord import ApplicationContext, Embed, option, TextChannel, Role from discord import ApplicationContext, Embed, option, TextChannel, Role
@ -14,7 +15,7 @@ from enums import Color
from modules.database import col_users from modules.database import col_users
from modules.utils_sync import guild_name from modules.utils_sync import guild_name
logger = logging.getLogger(__name__) logger: Logger = logging.getLogger(__name__)
class CustomChannels(commands.Cog): class CustomChannels(commands.Cog):

View File

@ -1,4 +1,5 @@
import logging import logging
from logging import Logger
from discord import ApplicationContext, Embed, User, option, slash_command from discord import ApplicationContext, Embed, User, option, slash_command
from discord.ext import commands from discord.ext import commands
@ -8,7 +9,7 @@ from classes.holo_bot import HoloBot
from modules.utils_sync import guild_name from modules.utils_sync import guild_name
from modules.waifu_pics import waifu_pics from modules.waifu_pics import waifu_pics
logger = logging.getLogger(__name__) logger: Logger = logging.getLogger(__name__)
class Fun(commands.Cog): class Fun(commands.Cog):

View File

@ -1,4 +1,5 @@
import logging import logging
from logging import Logger
from typing import Dict, Any from typing import Dict, Any
from discord import Member, Message, TextChannel, MessageType from discord import Member, Message, TextChannel, MessageType
@ -9,7 +10,7 @@ from libbot.utils import config_get
from classes.holo_bot import HoloBot from classes.holo_bot import HoloBot
from modules.database import col_users from modules.database import col_users
logger = logging.getLogger(__name__) logger: Logger = logging.getLogger(__name__)
class Logger(commands.Cog): class Logger(commands.Cog):
@ -43,7 +44,18 @@ class Logger(commands.Cog):
> 0 > 0
) )
): ):
await message.delete() try:
logger.info(
"Deleting the thread creation message in a custom channel %s",
message.channel.id,
)
await message.delete()
except Exception as exc:
logger.warning(
"Could not delete the thread creation message in a custom channel %s due to %s",
message.channel.id,
exc,
)
@commands.Cog.listener() @commands.Cog.listener()
async def on_member_join(self, member: Member) -> None: async def on_member_join(self, member: Member) -> None: