R
Railway2mo ago
Anubhav

how to configure discord bot

I am using poetry and the command to start app is poetry run start dont know how to deploy it , i also have some env vars that also dont know how to configure , i have 5 dollars plan
4 Replies
Percy
Percy2mo ago
Project ID: N/A
Anubhav
Anubhav2mo ago
N/A 14.98 Current Python version (3.11.9) is not allowed by the project (^3.12.4). 14.98 Please change python executable via the "env use" command.
2024-07-29 07:46:16.019 | DEBUG | afw_bot.ext.auto_sync_update:__init__:24 - 2024-07-29 07:46:16 data file not found creating one

2024-07-29 07:46:16.021 | INFO | afw_bot.ext.auto_legend_league:before_legend_league:148 - 2024-07-29 07:46:16 Waiting......

Traceback (most recent call last):

File "/app/afw_bot/main.py", line 87, in run

super().run(*args, **kwargs)

File "/root/.cache/pypoetry/virtualenvs/afw-bot-9TtSrW0h-py3.11/lib/python3.11/site-packages/discord/client.py", line 869, in run

asyncio.run(runner())

File "/root/.nix-profile/lib/python3.11/asyncio/runners.py", line 190, in run

return runner.run(main)

^^^^^^^^^^^^^^^^

File "/root/.nix-profile/lib/python3.11/asyncio/runners.py", line 118, in run

return self._loop.run_until_complete(task)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/root/.nix-profile/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete

return future.result()

^^^^^^^^^^^^^^^

File "/root/.cache/pypoetry/virtualenvs/afw-bot-9TtSrW0h-py3.11/lib/python3.11/site-packages/discord/client.py", line 858, in runner

await self.start(token, reconnect=reconnect)

File "/root/.cache/pypoetry/virtualenvs/afw-bot-9TtSrW0h-py3.11/lib/python3.11/site-packages/discord/client.py", line 786, in start

await self.login(token)

File "/root/.cache/pypoetry/virtualenvs/afw-bot-9TtSrW0h-py3.11/lib/python3.11/site-packages/discord/client.py", line 629, in login

await self.setup_hook()

File "/app/afw_bot/main.py", line 40, in setup_hook

await self.load_all_extensions()

File "/app/afw_bot/main.py", line 82, in load_all_extensions

await self.load_cog(f"afw_bot.ext.{module_name}")

File "/app/afw_bot/main.py", line 67, in load_cog

await self.add_cog(obj(self))

^^^^^^^^^

File "/app/afw_bot/ext/auto_sync_update.py", line 25, in __init__

self.initialize_sync_file()

File "/app/afw_bot/ext/auto_sync_update.py", line 32, in initialize_sync_file

with open(self.file_path, "w") as file:

^^^^^^^^^^^^^^^^^^^^^^^^^

FileNotFoundError: [Errno 2] No such file or directory: 'afw_bot/ext/utils/sync/data.json'

2024-07-29 07:46:16.046 | CRITICAL | afw_bot.main:run:90 - 2024-07-29 07:46:16 Login Failed

Reason: [Errno 2] No such file or directory: 'afw_bot/ext/utils/sync/data.json'

container event container died
2024-07-29 07:46:16.019 | DEBUG | afw_bot.ext.auto_sync_update:__init__:24 - 2024-07-29 07:46:16 data file not found creating one

2024-07-29 07:46:16.021 | INFO | afw_bot.ext.auto_legend_league:before_legend_league:148 - 2024-07-29 07:46:16 Waiting......

Traceback (most recent call last):

File "/app/afw_bot/main.py", line 87, in run

super().run(*args, **kwargs)

File "/root/.cache/pypoetry/virtualenvs/afw-bot-9TtSrW0h-py3.11/lib/python3.11/site-packages/discord/client.py", line 869, in run

asyncio.run(runner())

File "/root/.nix-profile/lib/python3.11/asyncio/runners.py", line 190, in run

return runner.run(main)

^^^^^^^^^^^^^^^^

File "/root/.nix-profile/lib/python3.11/asyncio/runners.py", line 118, in run

return self._loop.run_until_complete(task)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/root/.nix-profile/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete

return future.result()

^^^^^^^^^^^^^^^

File "/root/.cache/pypoetry/virtualenvs/afw-bot-9TtSrW0h-py3.11/lib/python3.11/site-packages/discord/client.py", line 858, in runner

await self.start(token, reconnect=reconnect)

File "/root/.cache/pypoetry/virtualenvs/afw-bot-9TtSrW0h-py3.11/lib/python3.11/site-packages/discord/client.py", line 786, in start

await self.login(token)

File "/root/.cache/pypoetry/virtualenvs/afw-bot-9TtSrW0h-py3.11/lib/python3.11/site-packages/discord/client.py", line 629, in login

await self.setup_hook()

File "/app/afw_bot/main.py", line 40, in setup_hook

await self.load_all_extensions()

File "/app/afw_bot/main.py", line 82, in load_all_extensions

await self.load_cog(f"afw_bot.ext.{module_name}")

File "/app/afw_bot/main.py", line 67, in load_cog

await self.add_cog(obj(self))

^^^^^^^^^

File "/app/afw_bot/ext/auto_sync_update.py", line 25, in __init__

self.initialize_sync_file()

File "/app/afw_bot/ext/auto_sync_update.py", line 32, in initialize_sync_file

with open(self.file_path, "w") as file:

^^^^^^^^^^^^^^^^^^^^^^^^^

FileNotFoundError: [Errno 2] No such file or directory: 'afw_bot/ext/utils/sync/data.json'

2024-07-29 07:46:16.046 | CRITICAL | afw_bot.main:run:90 - 2024-07-29 07:46:16 Login Failed

Reason: [Errno 2] No such file or directory: 'afw_bot/ext/utils/sync/data.json'

container event container died
locally its generating file why not its generating on railway
Joshie
Joshie2mo ago
For the environment variables, you define them in the variables tab https://docs.railway.app/guides/variables As for your code, it seems like you have a file as your "db". A file based "DB" doesn't work on this type of system. Any time your bot will be reset, you will lose the file. (It is not perseistant.) You should be using a volume to store your data.
Railway Docs
Using Variables | Railway Docs
Documentation for Railway
Anubhav
Anubhav2mo ago
Yeh add this thing now i have to look into the db stuff
Want results from more Discord servers?
Add your server