Zero6992 / chatGPT-discord-bot

Integrate ChatGPT into your own discord bot
GNU General Public License v2.0
2.63k stars 701 forks source link

It works! but do I have to always keep my pc and pyhton on? #322

Closed ImHack1993 closed 1 year ago

ImHack1993 commented 1 year ago

The bot in the discord will just disconnect once my python is closed. is there any way that I can make the bot always on so I can use it anywhere remotely?

FuseFairy commented 1 year ago

Can host on fly.io

ImHack1993 commented 1 year ago

Can host on fly.io

Tried for 3 hours but failed. fiald in writing a fly.toml file and make it work. Do not have much programming experiencešŸ˜­

namion commented 1 year ago

Now is a great time to jump in and explore self hosting. Grab an old Toshiba Thinkcentre micro PC, install Proxmox and enjoy

FuseFairy commented 1 year ago

Can host on fly.io

Tried for 3 hours but failed. fiald in writing a fly.toml file and make it work. Do not have much programming experiencešŸ˜­

Follow the tutorial will be successful https://www.youtube.com/watch?v=J7Fm7MdZn_E&t=15s

ImHack1993 commented 1 year ago

it works after another 3 hours! but I face this after put the Discord/OpenAI/Bard Token as fly secret. image

2023-04-05T13:44:21.921 app[e78490da255383] lax [info] 2023-04-05 13:44:21 INFO src.bot -> Hack-GPT#7797 is now running!

2023-04-05T13:46:19.138 app[e78490da255383] lax [info] 2023-04-05 13:46:19 INFO src.bot -> Hack#3536 : /chat [are you online now] in (private)

2023-04-05T13:46:19.140 app[e78490da255383] lax [info] [2023-04-05 13:46:19] [ERROR ] discord.app_commands.tree: Ignoring exception in command 'chat'

2023-04-05T13:46:19.140 app[e78490da255383] lax [info] Traceback (most recent call last):

2023-04-05T13:46:19.140 app[e78490da255383] lax [info] File "/usr/local/lib/python3.10/site-packages/discord/app_commands/commands.py", line 842, in _do_call

2023-04-05T13:46:19.140 app[e78490da255383] lax [info] return await self._callback(interaction, **params) # type: ignore

2023-04-05T13:46:19.140 app[e78490da255383] lax [info] File "/DiscordBot/src/bot.py", line 32, in chat

2023-04-05T13:46:19.140 app[e78490da255383] lax [info] await client.send_message(interaction, message)

2023-04-05T13:46:19.140 app[e78490da255383] lax [info] File "/DiscordBot/src/aclient.py", line 48, in send_message

2023-04-05T13:46:19.140 app[e78490da255383] lax [info] author = message.author.id

2023-04-05T13:46:19.140 app[e78490da255383] lax [info] AttributeError: 'Interaction' object has no attribute 'author'

2023-04-05T13:46:19.140 app[e78490da255383] lax [info] The above exception was the direct cause of the following exception:

2023-04-05T13:46:19.140 app[e78490da255383] lax [info] Traceback (most recent call last):

2023-04-05T13:46:19.140 app[e78490da255383] lax [info] File "/usr/local/lib/python3.10/site-packages/discord/app_commands/tree.py", line 1248, in _call

2023-04-05T13:46:19.140 app[e78490da255383] lax [info] await command._invoke_with_namespace(interaction, namespace)

2023-04-05T13:46:19.140 app[e78490da255383] lax [info] File "/usr/local/lib/python3.10/site-packages/discord/app_commands/commands.py", line 867, in _invoke_with_namespace

2023-04-05T13:46:19.140 app[e78490da255383] lax [info] return await self._do_call(interaction, transformed_values)

2023-04-05T13:46:19.140 app[e78490da255383] lax [info] File "/usr/local/lib/python3.10/site-packages/discord/app_commands/commands.py", line 860, in _do_call

2023-04-05T13:46:19.140 app[e78490da255383] lax [info] raise CommandInvokeError(self, e) from e

2023-04-05T13:46:19.140 app[e78490da255383] lax [info] discord.app_commands.errors.CommandInvokeError: Command 'chat' raised an exception: AttributeError: 'Interaction' object has no attribute 'author'
ImHack1993 commented 1 year ago

eventually, it works!