Changelog - Version 4.2 (2024-05-07)
Added
- Added
(user)which allows tagging any user in the custom command.if '(user)' in response: user_mention = re.search(r'<@(\d+)>', messageContent) if user_mention: mentioned_user_id = user_mention.group(1) # Use mentioned user's name user_name = await get_display_name(mentioned_user_id) else: # Default to message author's name user_name = messageAuthor response = response.replace('(user)', user_name) - Added
(command.)which allows calling other custom commands in the custom command. For example,(command.discord)would call the custom command called “discord”.if '(command.' in response: command_match = re.search(r'\(command\.(\w+)\)', response) if command_match: sub_command = command_match.group(1) mysql_cursor.execute('SELECT response FROM custom_commands WHERE command =(sub_command,)) sub_response = mysql_cursor.fetchone() if sub_response: response = response.replace(f"(command.{sub_command})", sub_response[0]) responses_to_send.append(sub_response[0]) else: chat_logger.error(f"{sub_command} is no longer available.") await message.channel.send(f"The command {sub_command} is no longer available.")
Fixed
- Fixed an issue in message counting where the broadcaster’s user level was incorrectly identified as a normal user instead of broadcaster.
is_broadcaster = messageAuthor.lower() == CHANNEL_NAME.lower() user_level = 'broadcaster' if is_broadcaster else 'mod' if is_mod else 'vip' if is_vip else 'normal' - Fixed an issue with the
process_raid_eventfunction where the data from the table wasn’t being fetched correctly. If there was existing data in the table, the raid count number and viewer count are adjusted correctly.mysql_cursor.execute('SELECT raid_count, viewers FROM raid_data WHERE raider_id = %s', (from_broadcaster_id,)) - Fixed an issue with the sending of the
discord_alert_onlinefunction where the URL wasn’t being found in the table.mysql_cursor.execute("SELECT discord_alert_online FROM profile") discord_url = mysql_cursor.fetchone() - Fixed an issue with the
builtin_commands_creationfunction where the commadns wern’t being inserted into the table correctly.if new_commands: placeholders = ', '.join(['(%s)'] * len(new_commands)) values = [(command,) for command in new_commands] mysql_cursor.executemany("INSERT INTO builtin_commands (command) VALUES " + placeholders, values) mysql_connection.commit()Changed
- Updated the
ad breakwording for better clarity and consistency.await channel.send(f"An ad is running for {formatted_duration}. We'll be right back after these ads.")