A python module made to make creating games easier and adds a bunch of game commands to your discord python bot
To install it from pypi, run
pip install disgamesTo install the development version, you need git installed. After installing it, run
pip install git+https://github.com/andrewthederp/Disgames- Import the class of the game you want from the controls type you want
- E.g.
from disgames.button_games import Chess
- E.g.
- Create an instance of the class while providing the necessary args/kwargs
- E.g.
game = Chess(ctx, white=ctx.author, black=member)
- E.g.
- Start the game by running the start function and providing the necessary args/kwargs
- E.g.
game.start(end_game_option=True)
- E.g.
More examples can be seen in examples/
You can configure some variables that are used throughout the module
disgames.ongoing_game_colorThe color of the embed while the game is still runningdisgames.lost_game_colorThe color of the embed when the player looses (only used in singleplayer games)disgames.won_game_colorThe color of the embed when the player winsisgames.drawn_game_colorThe color of the embed when the game drawsdisgames.resend_embed_listA list of strings, if the player sends a message which is in the list. The game embed will be re-sent (only used in message games)disgames.end_game_listA list of strings, if the player sends a message which is in the list. The game will end (only used in message games)
Example of changing a variable: disgames.drawn_game_color = 0x000000
The start function will return any of discord.Member/True/False/None/list/0
True/Falsewill only be returned if the game is a single player game and it means the author has won/lostNonemeans the game has ended in a drawdiscord.Membermeans that that person has won the gamelistwould be a list of bools, this is only returned bySoko. ATruewill be added into the list for every game the user wins. And the last item in the list will always beFalseifplay_foreveris set toTrue0means that the game timed out
Coming soon!
Note that this package only works with discord.py and other modules that use the discord namespace