yuugen's People
yuugen's Issues
Database Schema Design
Database Schema Design
We need to discuss and finalize the database schema for the Yuugen project. The database will play a crucial role in storing user-related data, guild-specific settings, music queue, and more. Below is the proposed schema for your review and discussion:
users
Table
-
id
(Primary Key) - Unique identifier for users. -
access_token
- Access token for user authentication. -
refresh_token
- Refresh token for user authentication. -
created_at
- Timestamp of when the user record was created.
guilds
Table
-
id
(Primary Key) - Unique identifier for guilds. -
admins
(Foreign Key) - References theusers
table for administrators. -
mods
(Foreign Key) - References theusers
table for moderators. -
music
(Foreign Key) - References themusic
table. -
settings
(Foreign Key) - References thesettings
table.
settings
Table
-
id
(Primary Key) - Unique identifier for settings. -
prefix
- Prefix for commands in a guild. -
music_mod
- Boolean flag for music moderation. -
guild_mod
- Boolean flag for guild moderation. -
txt2txt_mod
- Boolean flag for text-to-text AI moderation. -
txt2img_mod
- Boolean flag for text-to-image AI moderation.
music
Table
-
id
(Primary Key) - Unique identifier for music. -
songs
(Foreign Key) - References thesongs
table.
songs
Table
-
id
(Primary Key) - Unique identifier for songs. -
title
- Title of the song. -
author
- Author or artist of the song. -
url
- URL of the song. -
thumbnail
- Thumbnail of the song. -
duration
- Duration of the song. -
platform
- Platform of the song (eg. Youtube, Spotify...etc). -
requester_id
(Foreign Key) - References theusers
table to identify the user who requested the song. -
timestamp_added
- Timestamp of when the song was added to the queue.
Relationships
-
songs.requester_id
referencesusers.id
. -
music.songs
referencessongs.id
. -
guilds.music
referencesmusic.id
. -
guilds.settings
referencessettings.id
. -
guilds.admins
references multiple users in theusers
table. -
guilds.mods
references multiple users in theusers
table.
Source Link
You can view the schema design on Eraser.io.
Please review and provide feedback on this proposed schema. If there are any changes, additions, or optimizations needed, please let us know. Your input is essential in shaping the database structure for the Yuugen project.
This issue is open for discussion and collaboration. Feel free to leave comments and suggestions for improvement.
Music Management
Description
This issue focuses on the implementation of a music route in the Yuugen project, providing functionalities for music playback, queue management, and searching for tracks across multiple platforms (YouTube, Deezer, Spotify, SoundCloud) using URLs as prompts. The objective is to offer a seamless and feature-rich music experience to users.
Tasks
Music Playback and Control:
- Implement a music playback system that supports play, pause, and seek functionality.
- Allow users to skip to the next track.
- Enable users to go back to the previous track.
- Implement shuffle functionality for randomized playback.
- Support volume control and mute options.
- Implement repeat options, such as repeating the current track or the entire queue.
- Display track information, including title, artist, and duration, during playback.
- Provide playback progress information, including the current time and total duration.
Queue Management:
- Create routes and controllers for adding, removing, and updating songs in the queue.
- Develop a user-friendly interface for users to view and manage the queue.
- Implement features to clear the queue and enqueue multiple songs.
- Ensure efficient management of the queue with proper data structures.
Music Search Across Platforms:
- Enable users to search for tracks on YouTube, Deezer, Spotify, and SoundCloud using URLs as prompts.
- Implement API integrations with the respective platforms for seamless search.
- Handle and display search results in an organized manner.
Additional Considerations
- Secure and validate user inputs, especially for URL-based searches.
- Manage authentication and authorization for music route access.
- Implement proper error handling and return informative error messages.
- Ensure the integration of external APIs for search is reliable and consistent.
- Address performance considerations, such as limiting the number of search results.
- Account for user preferences and settings for music playback.
Guild Management
Description
This issue addresses the implementation of guild management features in the Yuugen project. Guild management is an integral part of the application, allowing users to manage their guilds and configure guild-specific settings.
Tasks
- Create routes and controllers for guild creation, modification, and deletion.
- Implement validation checks for guild information and settings.
- Store guild data securely in the database.
- Enable guild administrators to customize guild-specific settings, such as moderation, text-to-image, and text-to-text AI integrations.
- Implement access control mechanisms to ensure only authorized users can manage guilds.
- Add user-friendly error messages and validation feedback for guild management operations.
Additional Considerations
- Implement proper authentication and authorization for guild management.
- Secure guild data storage, following data protection and privacy regulations.
- Provide a clear and intuitive user experience for guild management.
- Consider data access and modification rules for guild-specific settings.
- Implement logging and auditing for guild management actions for security and compliance.
User Management
Description
This issue focuses on the implementation of user profile routes in the Yuugen project. These routes will enable users to view and manage their profiles and allow administrators to access user profiles by user ID.
Tasks
- Implement a "users/me" route for users to view their own profiles.
- Create a "users/:id" route to allow administrators to access user profiles by user ID.
- Implement role-based access control for the "users/:id" route, restricting access to administrators.
Additional Considerations
- Implement proper authentication and authorization mechanisms for user access.
- Secure user data storage, following data protection and privacy regulations.
Discord API Integration and Guild Management
Description
This issue is for the implementation of Discord API integration and comprehensive guild management features in the Yuugen project. This enhancement will allow the bot to interact with Discord servers efficiently and keep guild-specific settings up to date. The following tasks and features are included:
-
Integrate Discord API Wrapper: Implement an integration of a Discord API wrapper into the backend server. This integration is essential for the bot to communicate with Discord and retrieve information such as user data, guild information, and messages.
-
Utilize Necord for Reliability: Use Necord, a more reliable library, for handling Discord interactions instead of Discord.js. Necord has advantages such as easy integration with NestJS and streamlined functionality for handling Discord events.
-
Manage Guilds in the Database: Create and update guild records in the backend database for each guild that the bot joins. This allows us to store and manage guild-specific settings, prefixes, and more.
-
Listen for New Joining Guilds: Implement a mechanism to listen for new guilds that the bot joins and store their information in the database. This ensures that we have accurate records of all guilds the bot is part of.
-
Update Database on User Settings Change: Whenever a user within a guild changes their settings (e.g., custom prefix, moderation preferences), ensure that these changes are reflected in the backend database.
Authentication Step
Step: Authentication
This step involves setting up OAuth2 authentication with Discord to authenticate and authorize users for your application. OAuth2 is a protocol that allows your application to securely interact with Discord and verify user identities. To implement this step:
-
Create a Discord Developer Application:
- Go to the Discord Developer Portal.
- Click on "New Application" to create a new Discord Developer Application.
- Name your application and choose an avatar/logo for it.
-
Set Up OAuth2 Configuration:
- In your Discord Developer Application settings, go to the "OAuth2" tab.
- Under "OAuth2 URL Generator," select the scopes and permissions your application needs. Common scopes for Discord bots include "bot" and "applications.commands" for full bot access and interaction.
- Once you've selected the necessary scopes and permissions, the URL generator will provide an OAuth2 URL. This URL is used for user authorization.
-
Add the OAuth2 URL to Your Application:
- In your application's code, create a link or button that redirects users to the OAuth2 URL when they want to authorize your bot. This URL will prompt users to log in to their Discord account and authorize your bot to access the specified scopes and permissions.
-
Implement OAuth2 with Passport.js or a Similar Library:
- Use Passport.js or a similar library to handle OAuth2 authentication in your application.
- With Passport.js, you can configure strategies for OAuth2 authentication with Discord. You'll need to set up a strategy that validates the OAuth2 tokens and retrieves user information.
-
Handle OAuth2 Callback:
- After a user authorizes your application, Discord will redirect them to a callback URL specified in your Discord Developer Application settings.
- In your code, set up a route to handle this callback. Extract the OAuth2 code provided by Discord and exchange it for an access token and user information.
-
Store User Information:
- Once you have the user's access token and other relevant information, you can store this information in your database, linking it to the user's account.
-
Use User Authentication:
- Now that you have authenticated users, you can use their access tokens to make authenticated requests to the Discord API on their behalf. This allows your bot to interact with their Discord servers and perform authorized actions.
By completing these steps, your application will be able to authenticate and authorize users via Discord OAuth2, allowing them to access your bot's features and services securely. Additionally, it provides a level of user management and personalization for your application.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.