whuybrec / MiniGamesBot

A Python Discord bot that has different kinds of minigames
MIT License
47 stars 18 forks source link

How to add to my own bot? #2

Closed left-second closed 3 years ago

left-second commented 3 years ago

To get the bot up and running for yourself you'll need to fill in your bot's Discord token, your Discord ID and your bot's Discord ID in private.py

Sorry to bother but I'm stuck on adding it to my own bot. It's a html file and I can't seem to find where I can enter the token and ID's. Could you assist me further? Appreciated.

whuybrec commented 3 years ago

You don't need to use that html file. Check the contents of private.py in "Other" directory. Fill those in with the required IDs as I mentioned. Run main.py and it should work. Let me know if you have any other problems with this.

left-second commented 3 years ago

Hi, thanks for your response. I have added the token, my user id and bot id but when running main.py I get the following errors:

Traceback (most recent call last): File "C:\Users\User\Minigamesbot\main.py", line 1, in from minigamesbot import MiniGamesBot File "C:\Users\User\Minigamesbot\minigamesbot.py", line 7, in from Commands.minigames import blackjack_command, chess_command, connect4_command, quiz_command, hangman_command, \ File "C:\Users\User\Minigamesbot\Commands\minigames\checkers_command.py", line 3, in from Minigames.checkers.checkers import Checkers File "C:\Users\User\Minigamesbot\Minigames\checkers\checkers.py", line 6, in from checkers.game import Game ModuleNotFoundError: No module named 'checkers'

whuybrec commented 3 years ago

That error means that you have not installed the necessary packages to run the bot. Run the following command in the project directory: pip install requirements.txt

left-second commented 3 years ago

Reran requirements.txt and also tried doing them individually: python-chess, pillow, aiohttp, pydealer, discord, numpy, gpiozero, dblpy Requirements already satisfied.

whuybrec commented 3 years ago

It seems like I forgot to include that library in requirements.txt, my bad. Try this command to install checkers lib: pip install imparaai-checkers

left-second commented 3 years ago

It looks like we're getting closer. The import errors have disappeared thanks to you with the checkers installation. Now when I run the command, it returns these errors:

Loading database... Loading files... Traceback (most recent call last): File "C:\Users\User\Minigamesbot\main.py", line 6, in bot = MiniGamesBot("!") File "C:\Users\User\Minigamesbot\minigamesbot.py", line 18, in init self.on_startup() File "C:\Users\User\Minigamesbot\minigamesbot.py", line 45, in on_startup on_startup() File "C:\Users\User\Minigamesbot\Other\variables.py", line 176, in on_startup json1_file = open('Data/prefixes.json') FileNotFoundError: [Errno 2] No such file or directory: 'Data/prefixes.json' [Finished in 3.0s with exit code 1]

whuybrec commented 3 years ago

Create a file that's called prefixes.json at that location. Any other FileNotFoundErrors can be resolved doing that. I also suggest you do some python tutorials as are basic errors. You can analyse the code then too and make adjustments if you want.

left-second commented 3 years ago

I'll give this a last attempt. It seems the errors can't be solved without looking further into the code and making adjustments.

Loading database... Loading files... Traceback (most recent call last): File "C:\Users\User\Minigamesbot\main.py", line 6, in bot = MiniGamesBot("!") File "C:\Users\User\Minigamesbot\minigamesbot.py", line 18, in init self.on_startup() File "C:\Users\User\Minigamesbot\minigamesbot.py", line 45, in on_startup on_startup() File "C:\Users\User\Minigamesbot\Other\variables.py", line 178, in on_startup Private.prefixes = json.loads(json1_str) File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\json__init__.py", line 348, in loads return _default_decoder.decode(s) File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\json\decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "C:\Users\User\AppData\Local\Programs\Python\Python37\lib\json\decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

left-second commented 3 years ago

I've tried numerous times and I can't get it to work so I'll leave it here. You can close the issue if there's nothing to add.