@@ -45,13 +45,13 @@ def __init__(self, discord_sender):
45
45
# Initialize memory to store context
46
46
self .memory = []
47
47
48
- async def handle_command (self , command , args ):
48
+ async def handle_command (self , command , args , author ):
49
49
if command in self .handlers :
50
- await self .handlers [command ](args )
50
+ await self .handlers [command ](args , author )
51
51
else :
52
52
self .discord_sender .send_tagged_message ("unknown_command" , command )
53
53
54
- async def handle_anime (self , args ):
54
+ async def handle_anime (self , args , author ):
55
55
if args :
56
56
anime_details = self .anilist_handler .get_anime_details (args )
57
57
if isinstance (anime_details , dict ):
@@ -66,35 +66,40 @@ async def handle_anime(self, args):
66
66
else :
67
67
self .discord_sender .send_tagged_message ("anime_info" , "No anime name provided." )
68
68
69
- async def handle_manga (self , args ):
69
+ async def handle_manga (self , args , author ):
70
70
if args :
71
71
manga_description = self .anilist_handler .get_manga_description (args )
72
72
self .discord_sender .send_tagged_message ("manga_info" , manga_description )
73
73
else :
74
74
self .discord_sender .send_tagged_message ("manga_info" , "No manga name provided." )
75
75
76
- async def handle_character (self , args ):
76
+ async def handle_character (self , args , author ):
77
77
if args :
78
78
character_description = self .anilist_handler .get_character_description (args )
79
79
self .discord_sender .send_tagged_message ("character_info" , character_description )
80
80
else :
81
81
self .discord_sender .send_tagged_message ("character_info" , "No character name provided." )
82
82
83
- async def handle_rina (self , args ):
83
+ async def handle_rina (self , args , author ):
84
84
if args :
85
- # Use OpenAI API to generate a response based on user input
85
+ #send the personality to it in the beginning
86
+ if not self .memory : # Check if the memory is empty (conversation is just starting)
87
+ intro_message = "can you act like a anime girl with like a cute personality or hard one idk but like something along that line from next text on? noo no emotional thing into it just a text pls lol"
88
+ self .memory .append ({"role" : "assistant" , "content" : intro_message })
89
+
90
+ user_message = f"User ({ author } ): { args } " # Include the author's username
86
91
completion = self .client .chat .completions .create (
87
92
model = "meta-llama/llama-3.2-11b-vision-instruct:free" ,
88
- messages = self .memory + [{"role" : "user" , "content" : args }] # Append context to memory
93
+ messages = self .memory + [{"role" : "user" , "content" : user_message }] # Append context to memory
89
94
)
90
- response = completion .choices [0 ].message .content # Get the response
91
- self .memory .append ({"role" : "user" , "content" : args }) # Save user input to memory
95
+ response = completion .choices [0 ].message .content # response
96
+ self .memory .append ({"role" : "user" , "content" : user_message }) # Save user memory
92
97
self .memory .append ({"role" : "assistant" , "content" : response }) # Save AI response to memory
93
98
self .discord_sender .send_tagged_message ("rina_response" , response )
94
99
else :
95
100
self .discord_sender .send_tagged_message ("rina_response" , "No input provided." )
96
101
97
- async def handle_rec (self , args ):
102
+ async def handle_rec (self , args , author ):
98
103
if args :
99
104
rec = self .handle_rec .get_similar_anime (args )
100
105
if rec :
@@ -227,7 +232,7 @@ async def event_loop(ws):
227
232
command = command_parts [0 ].strip ().lower ()
228
233
args = ""
229
234
230
- await command_handler .handle_command (command , args )
235
+ await command_handler .handle_command (command , args , author )
231
236
232
237
if content .strip ():
233
238
command_parts = content .split (' ' , 1 )
0 commit comments