Commit Graph

60 Commits (experimental)

Author SHA1 Message Date
Kami 58270b1fbe PoE2Trade update
- Vastly improved on rate-limiting tolerance
  - Dynamically fetches and assigns any server-imposed rate-limits.
  - Implemented a rolling queue system for filter checks.
    - This effectively means each filter for all users will run one after the other. Increasing time between checks, but prevents rate-limiting.
- Improved notification message embeds to contain more information in a cleaner format
  - Added "implicit mods" to the stats list for better stats report
- Security implementations
  - PoE2 session token is now encrypted in storage
  - Somewhat sensitive data is now obscufated in settings reply
- Improved on listing pricing display
  - Now says "1 x Exalted Orb" instead of simply "1 exalted"
- Added approximated next check times for filters, viewable in notification messages and filters list
- General minor other improvements to readibility, commands, structure, cache, and functionality

Support for per-user-definable session tokens is in the works.
This will allow users to define their own tokens, which are encrypted for security, to reduce on ratelimits imposed by using the global token.
Once this is implemented, those users will benefit from faster checks, providing earlier listing notifications.
This should reduce the risk of missing valuable listings.
2025-03-30 14:46:23 +02:00
Kami f717ad0f14 PoE 2 Trading Site Implementation
This update includes implementation of Path of Exile 2 trading watchlisting, allowing users to get notified on Discord about new listings within the filter criteria.
- Multiple new commands
  - `!poe2trade`
    - DMs a message containing basic usage and instructions.
  - `!poe2trade add <filter_id> [filter_name]`
    - Adds a trade filter to their watchlist.
    - New matches will be sent to the user in a DM.
  - `!poe2trade remove <filter_id | all>`
    - Removes the specified filter from their watchlist.
    - If filter_id is set to `all`, it will clear all filters from their watchlist.
  - `!poe2trade list`
    - Lists the user's watchlisted filters, along with the filter nickname (if assigned).
  - `!poe2trade pause`
    - Stops watchlisting all their filters. No processing nor notifications are performed.
  - `!poe2trade resume`
    - Resumes the watchlisting of the user.
  - `!poe2trade set <key> <value>`
    - Allows admin/owner to modify settings without restarting the bot.
  - `!poe2trade settings`
    - Allows admin/owner to view current settings.
    - Will be updated in the future to allow non-admin users to view non-sensitive settings.
- Automatic notification of new listings in a neatly-formatted embed message
  - Currently, notification embeds contain: item name, item icon, item level, item stats, listed price, seller name (and account hyperlink), filter information, and instructions on removing the filter from watchlist.
  - Notification messages are condensed to avoid spam as much as possible; multiple new listings (up to 10) will be combined into a single message containing several embeds.
- Respects rate limits to avoid getting the bot locked out.
  - These ratelimits are set by GGG and CloudFlare, and are thus very strict. This shouldn't affect usability much however.
- Several minor QoL features

Still very much in active dev, so availability may fluctuate, and features will change.
Current TODO:
- Smart price-to-stat comparison
  - Determine listing value for the user to avoid being scammed, and easily pick up good deals.
  - Will compare item stats and listing price with other items of the same name, level and quality.
- Direct listing hyperlink
  - Currently, PoE 2's trading site does not support direct item links, so this has to be done by dynamically generate a filter that will only result in the relevant listing, providing easy direct access.
2025-03-26 20:42:16 +01:00
Kami d5581710a7 CustomVC Rework
- autoname implementation
    - Automatic channel naming can be toggled with `!customvc autoname`
    - Autoname status can be verified with `!customvc settings`
    - Autonaming will automatically apply game name as channel name if owner plays a game
    - If owner is not playing a game, channel name will default to `{userdisplayname}'s Channel´
    - Currently, checks are performed every 30s, and changes applied after a 5m cooldown
- Minor fix for the latest logging changes
  - Caller function was not correctly listed in log messages. This has been corrected.
2025-03-13 16:57:23 +01:00
Kami 5023ea9919 Reworked internal logging
- All logging functionality has been moved into the Logger class
  - Initiated globally as globals.logger()
  - Logging format changed from `globals.log("message_str", "LEVEL")` => `logger.level("message_str")`
- Minor changes to Twitch authentication
2025-03-13 14:17:43 +01:00
Kami d541f65804 Experimental early implementation of expanded permissions system and runtime checks 2025-03-08 18:11:42 +01:00
Kami d1faf7f214 Fixed Twitch bug
- Fixed an issue where Twitch users were not registered correctly due to recent DB changes
- Log-level of unidentified users changed from warning to info
- Minor changes to `!customvc`
  - Renamed `bitrate` -> `audio_bitrate`
  - Added `video_bitrate`
  - Changes some help text
  - Fixed certain subcommands which were broken after recent changes
  - Added `autoname` -> Automatically names the voice chat according to game being played by the owner
    - *Needs addiitonal work to implement all features*
2025-03-07 02:16:47 +01:00
Kami cce0f21ab0 Improved platform logging and Custom VC
- Platform logs associated to a message are now associated with platform-specific IDs
- Fixes for `!customvc`, specifically in relation to commands execution.
  - Optimized logic
  - Fixed limits for certain values like VC users limit
  - Better code integrity: now self-references as a Cog
- Lots of minor other tweaks, adjustments, and improvements
2025-03-06 17:53:54 +01:00
Kami 86ac83f34c Added basic custom VC functionality
- Supports a "VC Lobby" voice channel users can join to auto-create their own voice channel
  - That user is then the channel "owner".
  - Allows defining in-chat settings for each custom voice channel.
  - Empty channels auto-delete after 10s
  - Auto-deletes empty channels on startup
  - Auto-asigns the first user owner of the custom voice channel on startup if no data is retained
- Supports several commands:
  - `!customvc` -> Displays some help text
  - `!customvc name <new_name>` -> Renames the voice channel
  - `!customvc claim` -> Claim ownership of the voice channel if the owner has left
  - `!customvc lock` -> Locks the voice channel, preventing non-moderators from joining
  - `!customvc allow <some_user>` -> Allow a user into the locked voice channel
  - `!customvc deny <some_user>` -> Denies a non-mod user access to the voice channel
  - `!customvc unlock` -> Unlocks the voice channel. Denied users are still denied
  - `!customvc bitrate <kbps>` -> Set the bitrate for the voice channel (Should not be used unless needed)
  - `!customvc op <some_user>` -> Assing someone as co-owner of the voice channel
  - `!customvc settings` -> Display the current voice channel settings, including the owner
  - *It should be noted that moderators has the same access as channel owners for moderation purposes*
2025-03-02 01:52:42 +01:00
Kami 50617ef9ab Finalized database restructure, fixed Twitch auth issue
- Ironed out some issues with registering certain events into the database
- Fixed the old Twitch re-auth token issue. Now automatically renews it and initiates the bot with it.

These issues has been pestering the project a while now as they required some workarounds. Should work smoother from here on out! (I hope ...)
2025-03-01 23:14:10 +01:00
Kami d0313a6a92 Massive UUI system and database overhaul
- Dynamic accounts association
  - Accounts can now be associated dynamically, allowing multiple accounts on the same platform to be associated to the same UUID.
  - UUI system now supports any platform, eg. YouTube, TikTok, Kick, Twitter, etc.
  - More robust user lookups with enhanced fault tolerance and allowance for NULL data.
  - Optimized database structure with two tables for user association; one for UUID and basic info, another for platform-specific details.
- Enhanced logging functionality: logs now prefix the calling function.
- Enhanced user lookup debug messages, allowing easy query inspection and data validation.
- Other minor fixes
2025-03-01 01:54:51 +01:00
Kami 766c3ab690 Commands restructuring
- Reorganized commands into separate files for better fault tolerance and feature expandability
- Added basic dynamic bot status
  - Needs additional work. Currently very basic, planned features include fully dynamic mode with automatic alerts and such.
- Minor other tweaks
2025-02-23 17:00:45 +01:00
Kami 78e24a4641 Added Twitch channel game get function
- This function returns the game being played on the specified channel
- Implemented into quotes system: quotes automatically contain game name if quoted from a Twitch channel
- Defaults to None if channel is not live
- Discord quotes keep old logic: quotes never contain game information
2025-02-16 18:07:07 +01:00
Kami 17fbb20cdc Added Twitch multi-channel support
- OokamiPup v2 can now enter sevaral community channels
  - Individual channel settings. By default, all commands are disabled
  - Channel-specific settings allow enabling/disabling individual commands per channel
- Added a few more fun facts
- Minor tweaks and bugfixes
2025-02-16 15:30:17 +01:00
Kami 6da1744990 Added search feature to `!funfact`
- Users can now search for fun facts using `!funfact search [keywords]` without brackets. Returns best match.
- Also added some new facts
- Minor tweaks to force-sync of Discord slash commands
2025-02-14 11:42:20 +01:00
Kami 0f1077778f New `!funfact`/`!fun-fact` command
- This command returns a random fun fact from a list of over 500 verified fun, surprising, or good-to-know facts, with unit conversions between metric and imperial.
- Also started somewhat on the new Community Engagement Score (CES) system.
  - Currently not implemented to any working degree.
  - Will grant/deduct user scores depending on community engagement and actions overall.
2025-02-14 01:46:24 +01:00
Kami 01f002600c Bug tracking, minor tweaks
- Moved some constants to the globals.Constants class
  - config_data: returns the configuration dictionary
  - bot_start_time: returns the epoch bot start time
  - primary_discord_guild: returns a dict like `{"object": primary_guild_object, "id": primary_guild_int}`
  *These is initiated under globals.constants*
- Improved on docstrings. Google format now standard
- Reverted all commands to purely textual until further notice
  - `/help` is still additionally available as a slash command
2025-02-12 23:14:40 +01:00
Kami 1b141c10fb Big quote system overhaul
- Returned "quote" commands to textual commands type
- Rewritten quote system backend to ensure stability
- Added new quote subcommands:
  - `!quote search [keywords]` allow users to search for a quote using keywords, and returns the best match. If several equally good matches are found, returns one of them at random
  - `!quote info [quote_id]` allows users to see more info about a given quote. Grants more information on Discord
  - `!quote restore [quote_id]` allows users to restore a previously removed quote
  - `!quote last/latest/newest` allows users to get the newest quote
- Added new quote features to Discord helpfile
- Moved database init to globals.init_db_conn
- Associated unlinked usernames now default to that of the other platform, appended with "({platform} unlinked)". This should ensure consistensy despite users not linking accounts in the UAL system
- Added time_since(start, end, format) function to easily get formatted time differences, eg. for execution time reporting
- Added "wfstl" and "wfetl" helper function under utility. Useful for debugging when a function starts and ends manually if needed.
- Minor tweaks, corrections, bugfixes
2025-02-12 00:15:39 +01:00
Kami 71505b4de1 *ignore, just wanted to try out a crappy new logo for Discord push events* 2025-02-11 10:56:11 +01:00
Kami 66f3d03bc6 Program logging rework
- Logging functionality has been centralised to 'globals.log'

This should allow easy log integration into subsystems without the need of passing the function everywhere *phew*
2025-02-11 10:47:48 +01:00
Kami 699d8d493e Added latency to "ping" command
Ongoing bugfix for slash commands (#6)
2025-02-10 21:05:20 +01:00
Kami 623aeab9fb Fixed (?) a Twitch authentication crash
- The automatic token refresh function crashed after a certain time since last token refresh. This should fix it
2025-02-10 13:02:51 +01:00
Kami 3ad6504d69 mini-vacation update
- Dual logging
  - logfile.log = permanent logfile
  - cur_logfile.log = current run logfile
- Improved logging in general
- Expanded howl replies
- Discord activity logging
- Twitch & Discord chat logging
- Discord slash commands implementation (partial)
- Config file improvements
  - Toggleable log levels
  - Settings separated (terminal and file output)
  - Nesting of associated values
- Fixed "!ping" not fetching correct replies
- Several other minor and major fixes, tweaks and improvements
2025-02-10 12:32:30 +01:00
Kami aed3d24e33 Started implementing Universal User Identification (UUI)
- added database table "users"
- table allows for assigning individual users a UUID for universal processing
- will support account linking in the future

- fixed a bug with reporting Discord commands in logs
2025-02-05 00:33:02 +01:00
Kami 8074fbbef4 Cleaned log code lines 2025-02-04 13:35:25 +01:00
Kami 403ee0aed5 Ensure FATAL logs always go through to console 2025-02-04 13:21:33 +01:00
Kami 1a97a0a78e Reworked logging to optionally log to file as well 2025-02-04 13:16:03 +01:00
Kami 63256b8984 added logo to .gitignore 2025-02-03 23:02:44 +01:00
Kami faea372a56 Cleaned up command execution debug logs for better readability 2025-02-03 23:01:40 +01:00
Kami 87d05d961a Fixed !help not processing certain help sections correctly if example details were missing. 2025-02-03 22:37:20 +01:00
Kami 5730840209 Improved !help
- Ensured it fetches the correct commands and help configuration depending on platform.
- Removed certain duplicate checks that intiated functions twice or repeated value asignments.
- Added the @monitor_cmd flag to commands, allowing easy command runtime diagnostics, including execution time.
2025-02-03 22:02:56 +01:00
Kami 28d22da0c1 + Added !help command
- Removed built-in Discord !help command

NOTE:
Basic implementation.
Help text is defined in:
  - dictionary/help_twitch.json
  - dictionary/help_discord.json
2025-02-03 14:14:30 +01:00
Kami 780ec2e540 - Added basic SQL functionality with SQLite fallback.
- Added basic "Quote" system/command using the new DB feature.
2025-02-03 12:17:55 +01:00
Kami af97b65c2f Added BSL-1.1 license 2025-02-02 16:58:53 +01:00
Kami afa45aa913 Added basic string sanitization 2025-02-02 14:34:30 +01:00
Kami a83e27c7ed - Added automatic reconnect after refreshing Twitch bot token.
- Added reattempt limit to prevent Twitch ratelimiting.
2025-02-02 12:39:53 +01:00
Kami 095514d95d Added howling dictionary with conditional selection 2025-02-02 00:59:53 +01:00
Kami c4e51abc5b Specified platform commands were initiated from 2025-02-02 00:32:38 +01:00
Kami dd05c26b5d Added command logging to console 2025-02-02 00:29:58 +01:00
Kami 1bc5d5c042 . 2025-02-02 00:18:44 +01:00
Kami 29e48907df improved uptime calculation with fewer lines 2025-02-02 00:14:55 +01:00
kami 913f63c43b Add permissions.json 2025-02-01 22:41:27 +00:00
Kami 5725439354 . 2025-02-01 23:40:28 +01:00
Kami c2676cf8c7 Updated .gitignore to exclude permissions.json 2025-02-01 23:39:13 +01:00
Kami 1b9a78b3d6 Added basic permissions system.
Needs to be vastly improved
2025-02-01 23:38:13 +01:00
Kami 9ef553ecb0 - Added dictionary functionality
- Looks up a file in the "dictionary" folder
  - Returns a random category string within that file
- Added proper start time fetching through globals.get_bot_start_time()
2025-02-01 22:54:10 +01:00
Kami 2a977fe76e - Added readme.md 2025-02-01 21:28:26 +01:00
Kami 93e74f24df Merge branch 'master' of https://git.ookamikun.tv/kami/OokamiPupV2 2025-02-01 20:57:23 +01:00
Kami 82aec3dc5f - Reverted logging to a simpler terminal-only
- Added log levels in config.json
- Reworked requirements.txt
2025-02-01 20:50:54 +01:00
kami 4c1ce0e250 Add example.env
Added example .env file
2025-02-01 12:16:51 +00:00
Kami 9727927b66 Stopped tracking .env file 2025-02-01 13:13:17 +01:00