Discord-Bot-V3.6

ProfanityBlocker Release Notes


Hello there,

We are glad to inform you that the latest version Discord-Bot-V3.6 of ProfanityBlocker is out. Below is the list of JIRA issues that were part of this upgrade.

Summary -

Project - ProfanityBlocker
Version - Discord-Bot-V3.6
Planned Release Date -

New Feature

Priority Key Summary Description Status Component/s
Low PB-179 Support requests via bot

Allows Discord users to:

  • Create a support request
  • Be notified of replies to their ticket
  • Replies to tickets are sent as notifications, with a reply button and input modal

Additionally:

  • You can view all your open tickets and reply to a specific one
  • You can view all comments for a specific ticket
  • Autocomplete is available for easily specifying a ticket id 

 

Done Discord Bot
Low PB-172 Gamification system

Civility Gamification System

Overview

The Civility Gamification System is an innovative feature designed to encourage positive interactions and foster a friendly community environment. By rewarding users for maintaining civil discourse, this system aims to create a more engaging and respectful atmosphere within your Discord server.

 

How It Works

  1. Scoring: Users earn points for each "clean" (non-profane) message they send. Conversely, they lose points for messages flagged as inappropriate.
  2. Leveling: As users accumulate points, they progress through various levels, each associated with a unique title.
  3. Titles: Users earn increasingly prestigious titles as they level up, reflecting their commitment to civil communication.
  4. Streaks: The system tracks daily and weekly streaks of clean messages, encouraging consistent positive behaviour.
  5. Announcements: Level-ups are announced in the server, celebrating users' achievements and motivating others.

Benefits

  • Improved Community Atmosphere: Encourages users to think before posting, leading to more thoughtful and respectful conversations.
  • Increased Engagement: The leveling system and titles provide users with goals to strive for, increasing overall participation.
  • Positive Reinforcement: Celebrates good behaviour, making users feel valued for their positive contributions.
  • Self-Moderation: Users are motivated to maintain their scores and streaks, reducing the need for active moderation.
  • Community Pride: High-level users become role models, setting a positive example for others to follow.

Leveling System

  • Level 1: "Friendly Newcomer" (10 points)
  • Level 2: "Polite Speaker" (25 points)
  • Level 3: "Respectful Conversationalist" (50 points)
  • Level 4: "Eloquent Diplomat" (100 points)
  • Level 5: "Master of Etiquette" (200 points)
  • Level 6: "Paragon of Civility" (300 points)
  • Level 7: "Legendary Peacekeeper" (400 points)
  • Level 8: "Celestial Wordsmith" (500 points)
  • Level 9: "Divine Orator" (600 points)
  • Level 10: "Transcendent Sage" (700 points)

Commands

  • `pb!mystats`: Displays the user's current score, level, title, and streaks.
  • `pb!checkstats @user`: Displays the mentioned user's current score, level, title, and streaks. This command allows users to view and compare stats with others, fostering friendly competition and community engagement.

Implementation Details

  • The system uses Redis for fast, efficient data storage and retrieval.
  • Scores and levels are calculated in real-time as messages are processed.
  • The system includes debounce logic to prevent abuse or gaming of the system.

Customization

Server administrators might be able to customize various aspects of the system if people find this addition useful, including:

  • Point values for clean/profane messages
  • Leveling thresholds
  • Titles for each level
  • Announcement messages and channels
  • Assign roles, permissions, etc from levels
  • Allow more respected users to more questionable messages that newcomers might abuse

Conclusion

The Civility Gamification System is a powerful tool for cultivating a positive community culture. By gamifying good behavior, it transforms the challenge of maintaining a respectful environment into an engaging, community-wide activity that benefits all members. The ability to check other users' stats adds a social and competitive element, further encouraging participation and civil behavior.

In Review Discord Bot
High PB-59 Filter channel threads

Since initial design in 2019 Discord didn't have channel threads and appears the bot doesn't see channel thread messages in the same way as normal on_message events.

 

PB-61 along with its branch/PR introduces the fix for this: https://bitbucket.hosttweb.com/projects/PROF/repos/discord-bot/commits?until=refs%2Fheads%2FPB-61-migrate-discord.py-from-1.7.3-to-2.0.0

Done Discord Bot

Improvements

Discord Bot
Priority Key Summary Description Status Component/s
Low PB-169 Slash commands support (w/ legacy prefix), ignoreme a premium command, new ignoredusers and filtermodel commands

Transition to slash commands, with backwards compatibility for legacy prefix commands.

We also address the issue where ignoreme command was available to all (it is a premium command), added new ignoredusers and filtermodel command and spruced up commands with embeds, descriptions, fix ban command, etc

Done Discord Bot
Medium PB-148 Move Discord bot DM tracking regarding max requests to Redis storage

This helps with persistence so bot restarts will remember we messaged a guild owner about exceeding the plan limit.

Done Discord Bot
Blocker PB-138 Redis and celery - Database optimisations for Discord bot

As a Discord server has a lot of messages, or if a extension-used licence is tried against a Discord server, several functions go to the DB and execute painful request history logic. The extension highlighted the importance of fixing these painful queries (simulating a busy Discord server)

 

We replace painful SQL queries for profane word count with caching and incrementing via Redis

 

Notes:

 

Done Discord Bot
High PB-105 Improve onboarding if added with a bot invite link and no account

Discord bot flow from Discord app directory allows users to add bots without website prompt.

This issue aims to notify that they must visit our site if they want to manage the filter service with a Discord Oauth login link for our dashboard.

Done Discord Bot
Discord Bot, IFTTPB
Priority Key Summary Description Status Component/s
Medium PB-153 Quickfix: Refresh IFTTPB rules

Quick 5 minute refresh for rules. Improvements planned later on this issue.

Done Discord Bot, IFTTPB
Dashboard, Discord Bot
Priority Key Summary Description Status Component/s
Medium PB-145 Simplify onboarding for discord
  • Simplify invite screen with clearer text on the steps to complete setup.
  • Simplify and explain on the bot side what to do when the bot is directly invited (not via dashboard)
    • Strings in strings for easier maintainability
  • Specially crafted login link that leads to the Discord server Home page (one-click setup)
  • Use embeds to make the onboarding channel message tidier
  • Update dashboard bot command to use the one-click login to server home dashboard
Done Dashboard, Discord Bot
Discord Bot, Filter
Priority Key Summary Description Status Component/s
Medium PB-90 Better align filter and bot request history recording

Improve synchronization between the filter service and the Discord bot for recording request history.

Previously, both the filter service and the Discord bot were independently creating request history entries, resulting in duplicate entries. Furthermore, the fields in these entries did not match, leading to inconsistencies in the displayed data in the request history views.

To address this issue, we have implemented a solution. The filter service now includes the request ID it generates, and the Discord bot reads this ID to update the corresponding record with additional information, rather than creating a new entry in the database.

This ensures better alignment between the filter service and the Discord bot in recording request history, eliminating duplicate entries and ensuring consistent data in the request history views.

Done Discord Bot, Filter

Tasks

Celery, Dashboard, Discord Bot
Priority Key Summary Description Status Component/s
Medium PB-186 Instantly create licences for new bot users

Improved onboarding by creating a service licence on the spot, bypassing our background job which can take a few minutes - our analytics found users adding the bot, immediately sending content into their channel (presumably to test) and removing it when nothing happened (because licence setup in the background hadn't finished/ran yet.

Done Celery, Dashboard, Discord Bot
Discord Bot
Priority Key Summary Description Status Component/s
Highest PB-61 Migrate Discord.py from 1.7.3 to 2.x

V1.x API is EOL and will be dropped at the end of the year. Updating is necessary to make use of Threads/Forum type features as well.

Done Discord Bot
 

Subtasks

Discord Bot
Priority Key Summary Description Status Component/s
High PB-56 Lookup unprocessed messages and re-process them

This is necessary so that any disruption to a filter request is reprocessed if an error is returned from the service, or if we fail to process the message in a timely manner.

 

The on_message method in ProfanityBlocker.py checks if a message has been processed using the IsMessageProcessed method from the Database.py module. If the message has already been processed, it does nothing; otherwise, it continues processing the message.

The IsMessageProcessed method in Database.py checks if a message has been processed in the database by retrieving the request time for the message and checking if it has exceeded the max processing duration. If the message has not been processed or has exceeded the max processing duration, it returns False; otherwise, it returns True. If the message ID doesn't exist in the database, it inserts the message ID and request time.

Additionally, the MarkMessageAsProcessed method in Database.py marks a message as processed in the database by updating the processed flag and storing the request time for the message.

 

 

The logic in the reprocess_unprocessed_messages method respects the checks discussed earlier. When it fetches unprocessed messages and dispatches them using self.bot.dispatch('message', message), it effectively triggers the on_message method, which contains the checks for message processing. Therefore, the logic in reprocess_unprocessed_messages aligns with the message processing checks discussed previously.

Done Discord Bot
Medium PB-46 Long running OCR/message scans makes the bot loose heartbeat with Discord Done Discord Bot

Bugs

Discord Bot, IFTTPB
Priority Key Summary Description Status Component/s
Medium PB-178 Periodic Refresh of IFTTPB rules can cause bot stalls

Quick 5 minute refresh for rules can cause stalls if ProxySQL rejects the query because of long execution time.

In Review Discord Bot, IFTTPB
High PB-117 IFTTPB: Incorrect Method Call in Discord Bot Leads to TypeError in ProfanityBlocker Module

Steps to Reproduce
1. Start the Discord bot with the Auto Moderation feature enabled.
2. Ensure the bot is part of a Discord server (guild) and has appropriate permissions.
3. Trigger the profanity detection feature by sending a message that violates defined profanity rules.
4. Observe the bot's attempt to process the message and apply the configured rule via the DoRule method.
 
Expected Result
The bot should correctly identify the profanity, delete the offending message (if configured to do so), and apply any additional configured actions (e.g., notify the user or server admin) without any errors.
 
Actual Result
 
The bot encounters a TypeError when attempting to call the DoRule method from the ProfanityBlocker module, specifically indicating a missing required positional argument: 'id'. This error prevents the bot from executing the configured actions for detected profanity.
 
Proposed Fix * Issue: The DoRule method was incorrectly called as a static method of the IFTTPB class without an instance context, leading to argument mismatch and a TypeError.

  * Resolution: Modify the call to DoRule in the ProfanityBlocker module to use self.IFTTPB.DoRule, ensuring it is called on an instance of the IFTTPB class. This change provides the necessary context for the method to access its instance variables and execute correctly.

 
 
 
Code Change:
  * Before: IFTTPB.DoRule(4, user=message.author, Message=message, Channel=message.channel)

  * After: self.IFTTPB.DoRule(id=4, user=message.author, Message=message, Channel=message.channel)

 
Additional Notes
 

Additional files needed updating to use the instance of the class.

This fix aligns with object-oriented programming principles, ensuring that instance methods are called on the correct object instances. It resolves the TypeError and allows the bot to handle profanity detection and rule enforcement as expected.

Done Discord Bot, IFTTPB
Discord Bot
Priority Key Summary Description Status Component/s
Blocker PB-150 Regression: Discord bot is sending the wrong licence to the service for the Discord server

Fix issue where the bot is sending the wrong licence key for the guild the message was sent in...

Done Discord Bot
High PB-116 Max_processing_duration too low for messages

Max_processing_duration was set incorrectly, leading to duplicate message reprocessing, especially with slower detailed word analysis.

Another side effect was that image processing would not be done in time for the incorrectly set limit causing reprocessing of the image several times.

Done Discord Bot
Highest PB-107 Newly created licences aren't found by Discord bot

105 error code will get us to refresh the global PBGuilds - there are better ways to do this - will optimise in another release

Done Discord Bot
Dashboard, Discord Bot
Priority Key Summary Description Status Component/s
High PB-144 Discord bot can create guild entries twice and Dashboard throws an error if duplicate entries exist

Fix it. We now check if the guild already exists

Done Dashboard, Discord Bot
Discord Bot, Filter
Priority Key Summary Description Status Component/s
Low PB-108 Filter and bot should return an error code if licence does not exist, and message owner

We now return a service errorcode if the licence does not exist.

The bot already had an error code for this - I also tweaked the message, used a different code.

Done Discord Bot, Filter

 

Looking for more nitty gritty details? Take a look:

Number of issues resolved: 45 (including private issues)

Looking forward to hear your feedback.

 

Thanks,

Team ProfanityBlocker