semvec/pypi-packages huggingface dataset:
Discord-Games 1.2.2
A library to help users easily implement games within their discord bot
License: MIT
Requires Python: >=3.7

# Discord-Games

Discord-Games is a lib made for discord-bot makers.
It offers premade classes for your bot to use.
### Installing the package
```
$ pip install git+https://github.com/Tom-the-Bomb/Discord-Games.git
```
### Connect 4 Example

```py
from Discord_Games import connect_four

@commands.command(name="connectfour")
async def connectfour(self, ctx, member: discord.Member):
    game = connect_four.ConnectFour(
        red  = ctx.author,         # "red" player
        blue = member,             # "blue" player
    )
    await game.start(ctx, remove_reaction_after=True) #starts the game

```
Or for a more custom setup you can create a class that inherits from the "Game" class
- You can overwrite certain methods such as the `start` method.
**Methods for connect-four and tictactoe**
- `BoardString` - Returns a formatted version of the board-array
- `make_embed`  - builds the embed that specifies who's turn it is etc.
- `MakeMove`    - Edits the array after a move and changes the turn attr
- `GameOver`    - Checks if the game is over and changes the winner attr
- `start`       - starts the game and sets up the `wait_for` and method calls

**Methods for Hangman**
- `MakeGuess`   - modifies the attrs based on player input
- `CheckWin`    - Checks if the user won
- `start`       - starts the game and sets up `wait_for` and method calls

### 2048
2048 example
```py
from Discord_Games import twenty_48

game = twenty_48.Twenty48()
game.update_emojis(
    #a dictionary with number as a key and display value as value
    #ex: {"2": "<:two:123238299123342>"...}
)
await game.start(ctx, remove_reaction_after = True, delete_button = False, embed = discord.Embed())
# remove_reaction_after removes the reaction after add
# delete_button adds a stop_button to stop the game on click
# the embed kwarg is an example of the **kwargs
```
- For 2048 you need to call the `update_emojis` method and pass in a dict with the `block number` as a key and the `emoji` as the value
- If you do not want emojis to display the board you can do `"2": " 2 "` etc. to get the raw value displayed *(might look ugly though)*
- If you do not call the `update_emojis` method properly you may run into errors.



### chess
- start signature (Example)
`async def start(self, ctx: commands.Context, *, timeout: int = None, color: Union[int, discord.Color] = 0x2F3136, add_reaction_after_move: bool = False, **kwargs):`
- aside from that chess is much similar to all the other games and the same logic applies when using the classes



All the start methods accept any `**kwargs` and those get passed into the `.send()` in the function, 
so you can add any kwargs you might want to pass in to the message like `embed=` etc.
### Typeracer
```py
game = typeracer.TypeRacer()
await game.start(
    ctx, 
    embed_color=0x2F3136,                     #embed color
    path_to_text_font='assets/font_file.ttf', #or use arial.ttf if you dont have one
    timeout=100, 
    mode="sentence"
)
```
### Akinator
same as the previous games
carnival 1.3.1
Fabric-based software provisioning tool
License: MIT

# Carnival
[![Tests](https://github.com/carnival-org/carnival/workflows/Tests/badge.svg?branch=master)](https://github.com/carnival-org/carnival/actions?query=branch%3Amaster)
[![PyPI version](https://badge.fury.io/py/carnival.svg)](https://badge.fury.io/py/carnival)
[![PyPI](https://img.shields.io/pypi/pyversions/carnival.svg)](https://pypi.python.org/pypi/carnival)
[![Documentation Status](https://readthedocs.org/projects/carnival/badge/?version=latest)](https://carnival.readthedocs.io/)

![MIT](https://img.shields.io/github/license/carnival-org/carnival)

Software provisioning tool, built on top of [Fabric](http://www.fabfile.org/)

Also [carnival contrib package](https://github.com/carnival-org/carnival-contrib)
available.

* Runs on MacOs and Linux
* Tested on Ubuntu and CentOS

## Install
```bash
$ pip3 install carnival
$ pip3 install carnival_contrib  # Optional community receipts
```

## Docs
Documentation available at [readthedocs.org](https://carnival.readthedocs.io/ru/latest/)

## Cli
### Usage
```bash
$ carnival --help
Usage: carnival [OPTIONS] [deploy_frontend|deploy_backend]...

    Options:
    -d, --dry_run  Simulate run
    --debug        Turn on debug mode
    --help         Show this message and exit.
```

### Competion
* for *Bash*: place `eval "$(_CARNIVAL_COMPLETE=source carnival)"` in .bashrc
* for *ZSH*: place `eval "$(_CARNIVAL_COMPLETE=source_zsh carnival)"` in .zshrc

## Quick example
`carnival_file.py` - entry point for carnival cli

Lets create one.
```python
from carnival import Step, Host, Task, cmd

class Deploy(Task):
    def run(self):
        self.step(
            DeployFrontend(),
            Host("1.2.3.5", ssh_user="root", can="context", additional="give"),
        )

        self.step(
            DeployFrontend(),
            [
                Host("root@1.2.3.6", can="give", additional="context"),
                Host("root@1.2.3.7", can="context", additional="give"),
            ]
        )


class DeployFrontend(Step):
    def run(self, can, additional, **kwargs):
        cmd.apt.install_multiple("htop", "nginx")
        cmd.systemd.enable("nginx", start_now=True)


class DeployBackend(Step):
    def run(self, can, additional, **kwargs):
        cmd.apt.install_multiple("htop")
        cmd.docker.install_ce_ubuntu()
        cmd.docker.install_compose()
```

Run
```
$  python3 -m carnival deploy
💃💃💃 Runing ⛏frontend at 🖥 1.2.3.4
...
💃💃💃 Runing ⛏frontend at 🖥 1.2.3.5
...
```


## Develop
### Run tests
```bash
$ make dev  # Run docker containers for testing
$ make test_deps  # Install test dependencies
$ make test  # run static analyzers and tests
$ make qs  # Run static analyzers only
$ make nodev  # Stop docker containers
```

### Run carnival from dev env
```bash
$ python3 -m carnival --help
```