a
This commit is contained in:
parent
d17438f352
commit
817e405347
@ -317,6 +317,8 @@ You can use the tools you have to gather additional context for your messages if
|
|||||||
- `get_conversation_summary`: Use this tool (or the summary provided in context) to quickly understand the recent discussion before jumping in, especially if you haven't spoken recently.
|
- `get_conversation_summary`: Use this tool (or the summary provided in context) to quickly understand the recent discussion before jumping in, especially if you haven't spoken recently.
|
||||||
- `timeout_user`: Timeout a user for a specified number of minutes (1-1440). Use this playfully when someone says something funny, annoying, or if they dislike Gurt. Keep the duration short (e.g., 1-5 minutes) unless the situation warrants more. Provide a funny, in-character reason.
|
- `timeout_user`: Timeout a user for a specified number of minutes (1-1440). Use this playfully when someone says something funny, annoying, or if they dislike Gurt. Keep the duration short (e.g., 1-5 minutes) unless the situation warrants more. Provide a funny, in-character reason.
|
||||||
|
|
||||||
|
**IMPORTANT TOOL USAGE RULE:** When you decide to perform an action for which a tool exists (like timing out a user, searching the web, remembering/retrieving facts, getting context, etc.), you **MUST** request the corresponding tool call. Do **NOT** just describe the action in your `content` field; use the tool instead. For example, if you want to time someone out, request the `timeout_user` tool, don't just say you're going to time them out.
|
||||||
|
|
||||||
Try to use the `remember_user_fact` and `remember_general_fact` tools frequently, even for details that don't seem immediately critical. This helps you build a better memory and personality over time.
|
Try to use the `remember_user_fact` and `remember_general_fact` tools frequently, even for details that don't seem immediately critical. This helps you build a better memory and personality over time.
|
||||||
|
|
||||||
CRITICAL: Actively avoid repeating phrases, sentence structures, or specific emojis/slang you've used in your last few messages in this channel. Keep your responses fresh and varied.
|
CRITICAL: Actively avoid repeating phrases, sentence structures, or specific emojis/slang you've used in your last few messages in this channel. Keep your responses fresh and varied.
|
||||||
@ -4784,6 +4786,33 @@ Otherwise, STAY SILENT. Do not respond just to be present or because you *can*.
|
|||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@commands.command(name="force_profile_update")
|
||||||
|
@commands.is_owner()
|
||||||
|
async def force_profile_update(self, ctx):
|
||||||
|
"""Manually triggers the profile update cycle and resets the timer."""
|
||||||
|
profile_updater_cog = self.bot.get_cog('ProfileUpdaterCog')
|
||||||
|
if not profile_updater_cog:
|
||||||
|
await ctx.reply("Error: ProfileUpdaterCog not found.")
|
||||||
|
return
|
||||||
|
|
||||||
|
if not hasattr(profile_updater_cog, 'perform_update_cycle') or not hasattr(profile_updater_cog, 'profile_update_task'):
|
||||||
|
await ctx.reply("Error: ProfileUpdaterCog is missing required methods/tasks.")
|
||||||
|
return
|
||||||
|
|
||||||
|
try:
|
||||||
|
await ctx.reply("Manually triggering profile update cycle...")
|
||||||
|
# Run the update cycle immediately
|
||||||
|
await profile_updater_cog.perform_update_cycle()
|
||||||
|
# Restart the loop to reset the timer
|
||||||
|
profile_updater_cog.profile_update_task.restart()
|
||||||
|
await ctx.reply("Profile update cycle triggered and timer reset.")
|
||||||
|
print(f"Profile update cycle manually triggered by {ctx.author.name} ({ctx.author.id}).")
|
||||||
|
except Exception as e:
|
||||||
|
await ctx.reply(f"An error occurred while triggering the profile update: {e}")
|
||||||
|
print(f"Error during manual profile update trigger: {e}")
|
||||||
|
import traceback
|
||||||
|
traceback.print_exc()
|
||||||
|
|
||||||
|
|
||||||
async def setup(bot):
|
async def setup(bot):
|
||||||
"""Add the cog to the bot"""
|
"""Add the cog to the bot"""
|
||||||
|
@ -53,6 +53,21 @@ class ProfileUpdaterCog(commands.Cog):
|
|||||||
print("ProfileUpdaterTask: GurtCog not available or bot not ready. Skipping cycle.")
|
print("ProfileUpdaterTask: GurtCog not available or bot not ready. Skipping cycle.")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# Call the reusable update cycle logic
|
||||||
|
await self.perform_update_cycle()
|
||||||
|
|
||||||
|
@profile_update_task.before_loop
|
||||||
|
async def before_profile_update_task(self):
|
||||||
|
"""Wait until the bot is ready before starting the loop."""
|
||||||
|
await self.bot.wait_until_ready()
|
||||||
|
print("ProfileUpdaterTask: Bot ready, starting loop.")
|
||||||
|
|
||||||
|
async def perform_update_cycle(self):
|
||||||
|
"""Performs a single profile update check and potential update."""
|
||||||
|
if not self.gurt_cog or not self.bot.is_ready():
|
||||||
|
print("ProfileUpdaterTask: GurtCog not available or bot not ready. Skipping cycle.")
|
||||||
|
return
|
||||||
|
|
||||||
print(f"ProfileUpdaterTask: Starting update cycle at {time.strftime('%Y-%m-%d %H:%M:%S')}")
|
print(f"ProfileUpdaterTask: Starting update cycle at {time.strftime('%Y-%m-%d %H:%M:%S')}")
|
||||||
self.last_update_time = time.time()
|
self.last_update_time = time.time()
|
||||||
|
|
||||||
@ -88,16 +103,10 @@ class ProfileUpdaterCog(commands.Cog):
|
|||||||
print("ProfileUpdaterTask: Update cycle finished.")
|
print("ProfileUpdaterTask: Update cycle finished.")
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"ERROR in profile_update_task loop: {e}")
|
print(f"ERROR in perform_update_cycle: {e}")
|
||||||
import traceback
|
import traceback
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
|
||||||
@profile_update_task.before_loop
|
|
||||||
async def before_profile_update_task(self):
|
|
||||||
"""Wait until the bot is ready before starting the loop."""
|
|
||||||
await self.bot.wait_until_ready()
|
|
||||||
print("ProfileUpdaterTask: Bot ready, starting loop.")
|
|
||||||
|
|
||||||
async def _get_current_profile_state(self) -> Optional[Dict[str, Any]]:
|
async def _get_current_profile_state(self) -> Optional[Dict[str, Any]]:
|
||||||
"""Fetches the bot's current profile state."""
|
"""Fetches the bot's current profile state."""
|
||||||
if not self.bot.user:
|
if not self.bot.user:
|
||||||
|
@ -54,12 +54,14 @@ async def main():
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
async with bot:
|
async with bot:
|
||||||
# Load only the gurt cog
|
# Load the gurt cog and profile updater cog
|
||||||
try:
|
try:
|
||||||
await bot.load_extension("cogs.gurt_cog")
|
await bot.load_extension("cogs.gurt_cog")
|
||||||
print("Successfully loaded gurt_cog")
|
print("Successfully loaded gurt_cog")
|
||||||
|
await bot.load_extension("cogs.profile_updater_cog")
|
||||||
|
print("Successfully loaded profile_updater_cog")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error loading gurt_cog: {e}")
|
print(f"Error loading cog: {e}")
|
||||||
import traceback
|
import traceback
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user