diff options
Diffstat (limited to '')
| -rw-r--r-- | cogs/jarvis.py | 19 | ||||
| -rw-r--r-- | main.py | 4 |
2 files changed, 15 insertions, 8 deletions
diff --git a/cogs/jarvis.py b/cogs/jarvis.py index b199c8a..bdb34f1 100644 --- a/cogs/jarvis.py +++ b/cogs/jarvis.py | |||
| @@ -12,6 +12,7 @@ import logging | |||
| 12 | import shutil | 12 | import shutil |
| 13 | from dotenv import load_dotenv | 13 | from dotenv import load_dotenv |
| 14 | import os | 14 | import os |
| 15 | from tempfile import NamedTemporaryFile | ||
| 15 | from cogs.downloader import Downloader | 16 | from cogs.downloader import Downloader |
| 16 | 17 | ||
| 17 | logger = logging.getLogger(__name__) | 18 | logger = logging.getLogger(__name__) |
| @@ -48,7 +49,7 @@ class Jarvis(commands.Cog): | |||
| 48 | response_message, action = Jarvis._parse_response(response_data) | 49 | response_message, action = Jarvis._parse_response(response_data) |
| 49 | 50 | ||
| 50 | channel = message.channel | 51 | channel = message.channel |
| 51 | await channel.send(response_message) | 52 | await message.reply(response_message) |
| 52 | 53 | ||
| 53 | if action == "download": | 54 | if action == "download": |
| 54 | await Jarvis._handle_download_action(message, channel) | 55 | await Jarvis._handle_download_action(message, channel) |
| @@ -57,15 +58,17 @@ class Jarvis(commands.Cog): | |||
| 57 | def _build_messages(message): | 58 | def _build_messages(message): |
| 58 | messages = [{ | 59 | messages = [{ |
| 59 | "role": "system", | 60 | "role": "system", |
| 60 | "content": "your task is to tell the program what to do and how to respond after receiving a message.\n" | 61 | "content": "your name is Senator Sperma.\n" |
| 62 | "your task is to tell the program what to do and how to respond after receiving a message.\n" | ||
| 61 | "message field has to be filled out in polish.\n" | 63 | "message field has to be filled out in polish.\n" |
| 62 | "act like jarvis, be a personal assistant to user, do not use emojis\n" | 64 | "act like jarvis (only behavior wise), be a personal assistant to user, do not use emojis\n" |
| 63 | "do not ask the user if they want to do an action. the user will tell you that" | 65 | "do not ask the user if they want to do an action. the user will tell you that." |
| 64 | }] | 66 | }] |
| 65 | 67 | ||
| 66 | messages.append({ | 68 | messages.append({ |
| 67 | "role": "user", | 69 | "role": "user", |
| 68 | "content": f"[from {message.author.display_name}]: {message.content}" | 70 | "content": f"{message.author.display_name}: {message.content}" |
| 71 | |||
| 69 | }) | 72 | }) |
| 70 | 73 | ||
| 71 | if Jarvis._is_reply(message): | 74 | if Jarvis._is_reply(message): |
| @@ -83,11 +86,11 @@ class Jarvis(commands.Cog): | |||
| 83 | return [ | 86 | return [ |
| 84 | { | 87 | { |
| 85 | "role": "user", | 88 | "role": "user", |
| 86 | "content": f"[original message from {original_msg.author.display_name}]: {original_msg.content}" | 89 | "content": f"{original_msg.author.display_name}: {original_msg.content}" |
| 87 | }, | 90 | }, |
| 88 | { | 91 | { |
| 89 | "role": "user", | 92 | "role": "user", |
| 90 | "content": f"[reply from {message.author.display_name}]: {message.content}" | 93 | "content": f"{message.author.display_name}: {message.content}" |
| 91 | } | 94 | } |
| 92 | ] | 95 | ] |
| 93 | 96 | ||
| @@ -34,8 +34,12 @@ settings = "settings.json" | |||
| 34 | @bot.event | 34 | @bot.event |
| 35 | async def on_ready(): | 35 | async def on_ready(): |
| 36 | logger.info("ŁUKASZ SPERMA AKTYWACJA") | 36 | logger.info("ŁUKASZ SPERMA AKTYWACJA") |
| 37 | |||
| 37 | # send the message to channel ID | 38 | # send the message to channel ID |
| 38 | channel = bot.get_channel(1081667823799111804) | 39 | channel = bot.get_channel(1081667823799111804) |
| 40 | invite = await channel.create_invite(max_age=10, max_uses=1, unique=True) | ||
| 41 | print(f"One-time invite (expires in 1 s or after 1 use): {invite.url}") | ||
| 42 | |||
| 39 | await channel.send("ŁUKASZ SPERMA AKTYWACJA") | 43 | await channel.send("ŁUKASZ SPERMA AKTYWACJA") |
| 40 | if not os.path.exists(settings): | 44 | if not os.path.exists(settings): |
| 41 | async with aiofiles.open(settings, 'w') as f: | 45 | async with aiofiles.open(settings, 'w') as f: |
