1
Fork 0
mirror of https://github.com/allthingslinux/tux.git synced 2024-10-02 16:43:12 +00:00
Commit graph

37 commits

Author SHA1 Message Date
kzndotsh
f2cd0d58a7 refactor(schema.prisma): restructure schema for better organization and readability
feat(schema.prisma): add Starboard and StarboardMessage models for starboard feature
fix(schema.prisma): remove unnecessary comments and adjust model attributes for better data handling
feat(cases.py): change case_number to be dynamic instead of fixed format
feat(case.py): add functions to handle case count incrementation for better case tracking
2024-09-04 11:57:23 +00:00
kzndotsh
ebc652ce1c refactor(schema.prisma, case.py, note.py): rename 'target' to 'user' for better clarity
- 'case_target_id' and 'note_target_id' renamed to 'case_user_id' and 'note_user_id' respectively
- 'case_target_roles' renamed to 'case_user_roles'
- All related function names and parameters updated to reflect these changes
2024-08-27 10:31:49 +00:00
Atmois
b3acb6d6b0
Add snippet unban 2024-08-22 13:11:39 +01:00
Atmois
e3266a8595
add snippet ban as a moderation command 2024-08-21 12:52:36 +01:00
electron271
902ee244db
feat(snippets.py) implement snippet locking 2024-08-20 23:01:16 -05:00
electron271
33eed888b1
Snippet Statistics 2024-08-20 21:32:28 -05:00
kzndotsh
52cf304657 refactor(schema.prisma): simplify database URL environment variables for better maintainability
feat(bot.py): enhance logging for Prisma client setup and connection status for better debugging
style(bot.py): improve logging messages for better readability
feat(main.py): integrate Sentry setup into main function for better error tracking
refactor(constants.py): simplify database URL environment variables and add verbose loading for dotenv
chore(sentry.py): remove redundant Sentry setup file as setup is now integrated into main function
2024-08-11 02:36:21 +00:00
kzndotsh
88559952ff feat(schema.prisma): switch from development to production database by changing environment variables to improve data security and performance 2024-08-03 03:51:02 +00:00
kzndotsh
e43d8578ff feat(schema.prisma): uncomment development database URLs and comment production URLs for development testing
feat(pyproject.toml): add aiocache dependency for caching support
refactor(tux/cogs): change import style for checks from tux.utils
refactor(tux/cogs/admin/git.py): replace LinkButton with GithubButton for code reuse
refactor(tux/cogs/fun/xkcd.py): replace XkcdLinkButtons with XkcdButtons for code reuse
refactor(tux/cogs/guild/export.py): change import style for checks and exports from tux.utils
remove(tux/cogs/helpers.py): delete Helpers cog as it's no longer needed
refactor(tux/cogs/info/membercount.py): refactor member count command to return early if no guild is found

refactor(moderation): change import statement for checks module for better readability
feat(ban.py): add check_ban_conditions function to improve code reusability and maintainability
refactor(report.py): move ReportModal class to a separate file for better code organization

feat(snippets.py): add first and last page buttons to snippets list for better navigation
style(snippets.py): add line breaks for better code readability
fix(snippets.py): make error messages ephemeral and auto-delete after 30 seconds for cleaner chat
refactor(snippets.py): restructure snippet information embed for better readability and add bot latency
fix(client.py): disable query logging for better performance
refactor(guild_config.py): remove unused permission levels 8 and 9
fix(main.py): allow bot to mention roles for better user interaction
feat(buttons.py): add new buttons for XKCD and Github for better user experience
feat(report.py): add new report modal for anonymous reporting
refactor(constants.py): use config for TEMPVC constants instead of environment variables
style(embeds.py): simplify footer text in embeds for cleaner look
refactor(github.py): rename GitHubService to GithubService for consistency
2024-08-03 03:50:36 +00:00
kzndotsh
96af2c0bc6 feat(schema.prisma): switch from development to production database for deployment
refactor(cases.py): add UserConverter as fallback to MemberConverter for better user handling
feat(client.py): enable query logging in Prisma client for better debugging
feat(main.py): add startup log message for better tracking
feat(constants.py): add environment variables for database URLs to support both development and production environments
2024-07-31 23:30:05 +00:00
kzndotsh
78a9e17751 feat(schema.prisma): switch from production to development database for testing purposes
refactor(config.py): rename 'config_set_roles' to 'config_set_perms' for better clarity
feat(config.py): add new 'config_set_roles' command for role configuration
refactor(jail.py): improve error handling when jailing a user
fix(unjail.py): remove unnecessary return statement to allow case insertion even when no previous roles found
refactor(client.py): remove conditional debug check for database logging for cleaner code
2024-07-31 19:13:33 +00:00
kzndotsh
1680343f59 refactor(schema.prisma): switch from DEV_DATABASE_URL to PROD_DATABASE_URL for production readiness
refactor(constants.py): remove unused ROLES constant to clean up code
2024-07-31 07:16:59 +00:00
kzndotsh
c800bc72b2 docs(schema.prisma): add detailed comments for better understanding of the schema
refactor(schema.prisma): uncomment DEV_DATABASE_URL and DEV_DIRECT_URL for development database usage
style(schema.prisma): remove comment from case_status field for cleaner code
2024-07-31 06:21:36 +00:00
electron271
f323f1a35d
perm system part 1 2024-07-29 11:45:22 -05:00
kzndotsh
002e7d24b6 docs(PERMISSIONS.md): update permission levels to reflect changes in role hierarchy
refactor(schema.prisma): change perm_level_roles to perm_level_role_id for better clarity and consistency
refactor(config.py): update methods and messages to reflect changes in role handling
refactor(snippets.py): rename db_controller to db and config_db to config for better readability
refactor(snippets.py): update permission checks to use new perm_level_9_role_id
refactor(snippets.py): update db method calls to reflect new method names in DatabaseController

refactor(guild_config.py): reorganize methods under CRUD comments for better readability
feat(guild_config.py): add get_perm_level_role method to fetch role based on role type
feat(guild_config.py): add update_perm_level_role method to update role based on level
fix(guild_config.py): modify update_perm_level_role to use upsert instead of update for better data consistency
style(guild_config.py): remove commented out code for cleaner codebase
2024-07-28 19:46:56 +00:00
kzndotsh
83cf9fbb46 fix(schema.prisma): add @id decorator to guild_id in GuildConfig model to ensure uniqueness and prevent duplication
feat(pyproject.toml): add pydantic package to manage data parsing and validation more efficiently

refactor(config.py): remove ConfigSelectMenu and ConfigSelectView classes to reduce redundancy
feat(config.py): import ConfigSetChannels, ConfigSetPrivateLogs, ConfigSetPublicLogs from tux.ui.views.config for better modularity and code organization

refactor(config.py): simplify and restructure guild configuration commands

- Replace the individual role setting commands with a single `config_set_roles` command that uses a choice parameter for the permission level. This reduces code duplication and makes the command more flexible.
- Replace the individual log setting commands with a single `config_set_logs` command that uses a choice parameter for the log category. This reduces code duplication and makes the command more flexible.
- Add a new `config_set_channels` command for configuring guild channels. This provides a more intuitive and user-friendly way to configure channels.
- Remove commented out code to improve code readability and maintainability.

refactor: remove commented out code for cleaner codebase
feat: add 'config_get_roles' command to fetch guild roles for better role management

refactor(guild_config.py): remove unused role update methods to clean up code
feat(guild_config.py): add method to update permission level roles for better role management
fix(guild_config.py): ensure guild exists before updating guild config to prevent errors

feat(tux/ui/views/config.py): add new file to handle discord UI views for setting log and channel configurations

This commit introduces a new file, config.py, in the tux/ui/views directory. This file contains classes for handling discord UI views for setting private, public, and channel logs. Each class has methods for setting different types of logs or channels, such as private log, report log, dev log, mod log, audit log, join log, jail channel, starboard channel, and general channel. These methods update the respective log or channel ID in the database and send a confirmation message to the user.
2024-07-28 17:50:44 +00:00
kzndotsh
464a23af8e feat(settings.json): add PERMISSION_LEVELS object to manage user permissions more effectively
docs(PERMISSIONS.md): add new documentation file explaining the permissions management system
refactor(schema.prisma): simplify GuildConfig model by removing unnecessary fields and adding permission level roles fields for better permissions management

feat(config.py): add ConfigSelectMenu and ConfigSelectView classes for guild role configuration
refactor(config.py): replace individual role setting commands with a single command using the new classes
chore(config.py): comment out old role setting commands for reference, to be removed in future commits

refactor: consolidate channel setting commands into a single command for better maintainability
feat: add a new command to set all roles and channels using a select menu for improved user experience

feat: add role configuration options for different permission levels

This commit introduces the ability to configure roles for different permission levels (0-9) in the application. This allows for more granular control over user permissions and enhances the flexibility of the role management system.

refactor(client.py): conditionally set log_queries based on DEBUG constant for better control over logging in different environments

refactor(guild_config.py): simplify method and variable names for readability and maintainability
style(guild_config.py): improve code formatting for better readability

refactor(guild_config.py): simplify variable names by removing redundant 'guild_' prefix
chore(guild_config.py): comment out unused methods to improve code readability and performance

refactor(guild_config.py): simplify field names for better readability and consistency
feat(guild_config.py): comment out unused role retrieval methods to improve performance
chore(guild_config.py): add commented out code for future permission level roles feature

fix(main.py): uncomment debug related imports and function calls to enable debugging
feat(constants.py): change default value of DEBUG constant to True to enable debugging by default
2024-07-27 20:21:24 +00:00
kzndotsh
732f353a36 refactor(schema.prisma): rename enum values HACK_BAN and TEMP_BAN to HACKBAN and TEMPBAN for consistency
feat(schema.prisma): add case_status field to Case model to track case status
fix(schema.prisma): change case_number and note_number types from Int to BigInt to handle larger numbers

docs(case.py): add docstrings to methods in CaseController class to improve code readability and provide detailed information about the methods' functionality and parameters
refactor(case.py): remove get_all_cases and get_case_by_id methods from CaseController class as they were not being used, reducing unnecessary code
feat(case.py): import logger from loguru for better logging capabilities
feat(case.py): import CaseWhereInput from prisma.types to handle case queries more efficiently

refactor(case.py): simplify case retrieval methods in CaseController

- Replace multiple specific case retrieval methods with more general methods that accept options for filtering.
- This reduces code duplication and improves maintainability.
- Add docstrings to new methods to improve code readability and provide usage information.

refactor: simplify and optimize case retrieval methods in the database layer
feat: add update_case method to allow case reason and status modification
feat: add delete_case_by_number method to allow case deletion by its number
2024-07-22 16:39:18 +00:00
kzndotsh
78630c3b80 feat(pre-commit-config.yaml): update ruff-pre-commit version to v0.5.3 for latest features and bug fixes
refactor(schema.prisma): switch from PROD to DEV database URLs for development testing
feat(schema.prisma): add JAIL and UNJAIL to CaseType enum to support new jail feature
feat(schema.prisma): add case_target_roles field to Case model to store jailed user's roles
refactor(schema.prisma): add comments to case_number and case_expires_at fields for clarity
refactor(schema.prisma): add comment to reminder_channel_id field for clarity
feat(jail.py): add new Jail cog for jailing users in the server

feat(unjail.py): add new Unjail class to handle unjailing of users
feat(case.py): add method to get last jail case by target id and guild id for unjailing process
feat(flags.py): add JailFlags and UnjailFlags classes to handle command flags for jailing and unjailing commands
2024-07-19 09:12:51 +00:00
kzndotsh
37c796d24e feat(schema.prisma): add DEV_DATABASE_URL and DEV_DIRECT_URL as commented lines for easy switch between prod and dev databases
refactor(schema.prisma): reorder CaseType enum values for better readability
fix(schema.prisma): rename TIMEOUT_ADD and TIMEOUT_REMOVE to TIMEOUT and UNTIMEOUT for better semantics
2024-07-13 19:37:14 +00:00
kzndotsh
d96ffa5492 feat(schema.prisma): add GuildConfig model to store guild-specific configurations
refactor(schema.prisma): add unique and index constraints to Guild and Reminder models for better data integrity and query performance
refactor(__init__.py): rename controllers to singular form for better semantics
feat(__init__.py): add GuildController and GuildConfigController to DatabaseController for handling guild and guild config related operations

feat(case.py): add CaseController class to handle database operations for cases

This commit introduces a new class, CaseController, in the case.py file. This class provides methods for various database operations related to cases, such as getting all cases, getting a case by its ID, inserting a new case, deleting a case by its ID, updating a case by its number and guild ID, and various methods for getting cases based on different parameters. This class will help in managing the cases in the database in a more structured and efficient way.

feat(database/controllers/guild.py): add GuildController class to manage guild operations
This class includes methods to get, insert, and delete guilds by id.

feat(guild_config.py): add GuildConfigController class to manage guild configurations

This new class provides methods for creating, updating, and retrieving guild configurations. It also ensures that a guild exists before performing operations. This change allows for more efficient and organized management of guild configurations.

feat(database/controllers): add NoteController, ReminderController, SnippetController classes for database operations
- NoteController provides methods for CRUD operations on notes and fetching notes based on various parameters
- ReminderController provides methods for CRUD operations on reminders
- SnippetController provides methods for CRUD operations on snippets and fetching snippets based on various parameters
2024-07-02 02:28:00 +00:00
kzndotsh
692855e6be Refactor database models and clean up archive
Temp moving moderation and misc files to .archive for cleanup purposes.
Updated `schema.prisma` to use environment variables for production.
Removed redundant user, role, and emoji statistics database models and associated controllers.
Integrated a new `Case` model to consolidate infraction-related data.
Modified reminder, snippet, and note models, and their corresponding controllers to streamline and standardize the database structure.
Removed outdated database seeding commands.
2024-06-29 06:08:48 -04:00
electron271
4c91019ec7
[Commands] Make snippets per-guild 2024-05-14 12:46:03 -05:00
electron271
0f3c03f0fd
[DB] Add emoji statistics 2024-04-29 16:29:52 -05:00
electron271
3aa6542985
[Commands] add reminders 2024-04-22 10:57:15 -05:00
kzndotsh
9268f8a27e feat(schema.prisma): add Commands and CommandStats models to track command usage
fix(schema.prisma): set default value for bot field in Users model to false
feat(error_handler.py): add handling for CommandNotFound error
refactor(ban.py, kick.py): add database logging for infractions, improve error handling and embed creation
feat(ban.py, kick.py): add support for Jr. Mod role in ban and kick commands
docs(kick.py): add docstrings for methods and class

feat(warn.py): add database integration for warnings, now warnings are stored in the database
refactor(warn.py): improve warning embeds, now they include more detailed information
refactor(infractions.py): move InfractionType enum to a separate file for better organization
feat(constants.py): add new constants for infraction embeds
feat(embeds.py): add new method for creating infraction embeds
feat(enums.py): new file for storing enums, starting with InfractionType
2024-04-14 05:57:53 +00:00
kzndotsh
a9632dd1c6 refactor(schema.prisma): replace unique constraint with composite primary key in UserRoles model for better data integrity
feat(db.py): add seed_user_roles command to seed user roles from discord guild
style(db.py): replace hardcoded message with constant GUILD_ONLY_MESSAGE for better maintainability
refactor(tldr.py): change create_default_embed to create_info_embed for better semantics
feat(__init__.py): add UserRolesController to DatabaseController for handling user roles operations
feat(user_roles.py): add UserRolesController for CRUD operations on user roles in the database
2024-04-12 21:45:03 +00:00
kzndotsh
67cdc52212 chore(pre-commit-config.yaml): update ruff-pre-commit version to v0.3.6 for latest features and bug fixes
feat(mypy.ini): add new mypy.ini file for better type checking configuration
fix(schema.prisma): make created_at field in Users model nullable to handle users without creation time
feat(schema.prisma): add color field to Roles model to store role's color information
refactor(pyproject.toml): rearrange linting configuration for better readability and remove redundant mypy configuration
2024-04-11 17:56:45 +00:00
kzndotsh
0495b70a88 refactor(schema.prisma): remove commented out SQLite datasource to clean up code
refactor(constants.py): rename CHANNELS to LOG_CHANNELS for better clarity
feat(constants.py): add LOG to EMBED_STATE_COLORS and EMBED_STATE_ICONS for log embeds
feat(constants.py): add EMBED_SPECIAL_CHARS for special character usage in embeds
feat(embeds.py): add set_image method to EmbedCreator for image support in embeds
feat(embeds.py): add create_log_embed method to EmbedCreator for creating log embeds
feat(functions.py): add compare_changes, extract_guild_attrs, extract_member_attrs functions for better data handling
2024-04-09 07:25:57 +00:00
kzndotsh
22cd22c795 refactor(schema.prisma): rename 'author' and 'author_id' to 'user' and 'user_id' in Reminders model for better clarity and consistency with other models
feat(database/controllers.py): add CRUD operations for users in UsersController
feat(database/controllers.py): add CRUD operations for infractions in InfractionsController
feat(database/controllers.py): add CRUD operations for notes in NotesController
feat(database/controllers.py): add CRUD operations for snippets in SnippetsController
docs(database/controllers.py): add docstrings to all methods in UsersController, InfractionsController, NotesController, and SnippetsController
refactor(database/controllers.py): add type hints to all methods in UsersController, InfractionsController, NotesController, and SnippetsController
feat(database/controllers.py): import Reminders model from prisma.models
feat(database/controllers.py): import datetime module for handling date and time data

docs(database/controllers.py): add docstrings to SnippetsController and RemindersController methods for better code understanding
feat(database/controllers.py): add RemindersController class to handle database operations related to reminders
refactor(database/controllers.py): add RemindersController to DatabaseController for centralized database operations management

style(embeds.py): add line breaks for better code readability and maintainability
2024-04-07 01:53:58 +00:00
kzndotsh
e5af901ff3 docs(README.md): update command instruction to include server id for clarity
refactor(schema.prisma): add autoincrement() to id fields in Infractions, Notes, Reminders models for automatic id generation
feat(controllers.py): add toggle_afk method in UsersController to enable/disable afk status
refactor(controllers.py): remove infraction_id from create_infraction method in InfractionsController as id is autoincremented
feat(controllers.py): add create_note, delete_note, update_note methods in NotesController for note management
2024-04-06 13:41:11 +00:00
kzndotsh
2ffe01954e chore: remove opencommit.yml workflow as it's no longer needed
refactor(schema.prisma): change InfractionType from enum to string for flexibility
refactor(schema.prisma): make created_at fields nullable and default to now() for better data consistency
refactor(database/controllers.py): rename find_users and find_user to get_all_users and get_user_by_id for better readability
feat(database/controllers.py): add InfractionsController and SnippetsController to handle infractions and snippets related operations
refactor(database/controllers.py): move InfractionType enum to controllers.py for better organization
2024-04-05 23:29:51 +00:00
kzndotsh
89d8fd788e [DB] Add example controller 2024-04-05 18:46:28 -04:00
kzndotsh
030d0647b9 fix(schema.prisma): refactor schema to improve readability and remove unused models
feat(schema.prisma): add new models for Settings, Notes, and Reminders to support new features
fix(main.py): move database connection after starting coroutines to ensure they are started before connecting to the database
feat(main.py): add log message for closing database connection to improve debugging
2024-04-05 21:22:12 +00:00
kzndotsh
8a4fd58f20 feat(schema.prisma): switch database provider from sqlite to postgresql for better scalability and performance
chore(schema.prisma): comment out old postgresql datasource configuration for future reference

refactor(schema.prisma): update database schema to better represent Discord data

- Replace 'roles' model with 'Users' and 'Roles' models to separate user and role data
- Add 'UserRoles' model to represent many-to-many relationship between users and roles
- Replace 'notes' model with 'Infractions' and 'Snippets' models to separate infraction and snippet data
- Remove 'moderators', 'settings', 'logs', 'guilds', and 'messages' models as they are not needed in the new schema
- Add 'InfractionType' enum to represent different types of infractions
- Update comments to better explain the purpose of each model and field

These changes were made to better align the database schema with the data provided by Discord and to simplify the data model.

feat: add new models for logs, user_roles, notes, snippets, guilds, infractions to extend database schema

WHY: To support new features such as logging, user roles, moderator notes, text snippets, guilds, and user infractions.
2024-04-05 18:41:20 +00:00
kzndotsh
6a2dbd7003 [Refactor] More major changes, replaced supabase client with prisma, added error handler concept 2024-03-28 01:20:05 -04:00
kzndotsh
772eae6a2d [Refactor] Major changes to dir structure, temp removal of permissions, added loguru, added some async libs, improve types, clean pyproject config 2024-03-27 16:16:33 -04:00