Skip to content

Commit

Permalink
docs: readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Okaneeee committed Oct 20, 2024
1 parent 75c7a51 commit e1aea1f
Show file tree
Hide file tree
Showing 2 changed files with 145 additions and 30 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
TOKEN =
OWNERID =
173 changes: 143 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,143 @@
# SWCodes
SW Codes is a discord bot to facilitate the use of codes on the mobile game Summoners War


## TODO:
### Commands
- [x] Add a command to show the list of all commands and descriptions (/help)
- [x] Add a command to use a code on an account (/usecode 『hiveid』 『code』)[^5]
- [x] Add a command to register an ID to the list of IDs (/registerid 『hiveid』)[^1] [^5]
- [x] Add a command to unregister an ID from the list of IDs (/unregisterid 『hiveid』)[^5] [^6]
- [x] Add a command to use a code on all registered IDs (/trigger 『code』)[^2]

### Features
- [x] A JSON file to store the list of registered IDs (a real db is overkill)[^3] [^4]

### Extra
- [x] Change `token` to a `.env` file with token & ownerid
- [x] Add a log system
- [ ] Make a proper README

### Lastly
- [x] Test the bot
- [ ] Host the bost on OCI

[^1]: Add a disclaimer or something to tell the user agree to share their ID and have it stored in a file (private for everyone but the bot owner)
[^2]: See if it won't cause trouble with the API/avoid banning accounts, maybe limit the number of registered IDs or only allow the command for the owner
[^3]: Add the list to the [`.gitignore`](./.gitignore) file for security reasons
[^4]: HiveID : DiscordID for key-value pairs
[^5]: Use ephemeral messages for privacy
[^6]: Only the one who registered the ID can unregister it
<p align="center">
<img src="https://upload.wikimedia.org/wikipedia/fr/c/c2/Summoners_War_Logo.png" width="300" alt="sw logo"></img>

<h1 align="center">
🔖 SW Codes 🔖
</h1>
</p>

## Table of Content
<details>
<summary> Click me! </summary>

- [Getting Started](#getting-started)
- [Installation](#installation)
- [Quick Start](#quick-start)
- [Commands](#commands)
- [Long-Term Support (LTS)](#long-term-support-lts)
- [As the developer](#as-the-developer)
- [Dependencies](#dependencies)
- [Code Quality & Security](#code-quality--security)
- [References](#references)
- [Copyrights](#copyrights)

</details>

## Getting Started
### Installation

<details>
<summary> Instructions for cloning with git (recommended) </summary>

- Open a terminal and navigate to the directory where you want to clone the repo.
- Run the following commands:
```bash
git clone https://github.com/Okaneeee/SWCodes.git
cd SWCodes
```

</details>

<br>


<details>
<summary> Instructions for zip downloading </summary>

- Click on the green `Code` button and select `Download ZIP` or click [here](https://github.com/Okaneeee/SWCodes/archive/refs/heads/main.zip).
- Extract the zip file to the directory where you want to clone the repo. Or in Linux:
```bash
sudo apt-get install unzip
unzip SWCodes-main.zip
```
- Open a terminal in the folder where you extracted the zip file and run the following command:
```bash
cd discord-chatbot
```
</details>
<br>
This repo was made with Python ``3.11.9``. So you'll need to install python. You can check the working versions of Python for this repo [here](#dependencies). <br>
The repo uses some dependencies. You can install them by running the following command:
Windows:
```bash
pip install -r requirements.txt
```
Linux:
```bash
pip3 install -r requirements.txt
```
<br>
### Quick Start
You'll need to setup a `.env` file first. The `.env` need to be on the same folder as the repo. You can use the following template, or you can rename the [`.env.example`](./.env.example) file to `.env`.
```env
TOKEN =
OWNERID =
```
**TOKEN** is the bot token you get from the [Discord Developer Portal](https://discord.com/developers/applications). <br>
*More information [here](https://discord.com/developers/docs/getting-started#configuring-your-bot).* <br>
**OWNERID** is the ID of the owner (you). You can get your ID by right-clicking your name in Discord and selecting `Copy ID`. <br>
*More information on how to get your ID [here](https://support.discord.com/hc/en-us/articles/206346498).*
<br>
After, you'll need to [add your bot to your server](https://discord.com/developers/docs/getting-started#installing-your-app). <br>
Finally, you can run the bot by running the following command:
```bash
python src/main.py
```
## Commands
- `/help`
> Shows the help message with all the commands listed.
- `/usecode [hiveid] [code]`
> Use a code on an account.
- `/registerid [hiveid]`
> Register your Hive ID (linked in the database with the Discord ID of the command invoker).
- `/unregisterid [hiveid]`
> Unregister your Hive ID (only the one who registered it can unregister it).
- `/trigger [code]`
> Trigger a code on all registered Hive IDs. <br>
> **ONLY THE OWNER CAN USE THIS COMMAND**.
## Long-Term Support (LTS)
### As the developer
I will be maintaining this repo for a long time. I will be fixing eventual bugs and do the necessary changes in case of a new Discord API update, a new Python version or if the Summoners War API changes. <br>
I will also be updating the dependencies with [Dependabot](https://github.com/dependabot). <br>
### Dependencies
| Version | Done | Status |
|-------------------------|------|--------|
| Python 3.10 | ✔ | [![Python 3.10](https://github.com/Okaneeee/SWCodes/actions/workflows/python310.yml/badge.svg)](https://github.com/Okaneeee/SWCodes/actions/workflows/python310.yml) |
| Python 3.11 | ✔ | [![Python 3.11](https://github.com/Okaneeee/SWCodes/actions/workflows/python311.yml/badge.svg)](https://github.com/Okaneeee/SWCodes/actions/workflows/python311.yml) |
| Python 3.12 | ✔ | [![Python 3.12](https://github.com/Okaneeee/SWCodes/actions/workflows/python312.yml/badge.svg)](https://github.com/Okaneeee/SWCodes/actions/workflows/python312.yml) |
### Code Quality & Security
| Actions | Done | Status |
|-------------------------|------|--------|
| CodeQL | ✔ | [![CodeQL](https://github.com/Okaneeee/SWCodes/actions/workflows/codeql.yml/badge.svg)](https://github.com/Okaneeee/SWCodes/actions/workflows/codeql.yml) |
| Dependabot | ✔ | [![Dependabot](https://github.com/Okaneeee/SWCodes/actions/workflows/dependabot/dependabot-updates/badge.svg)](https://github.com/Okaneeee/SWCodes/actions/workflows/dependabot/dependabot-updates) |
## References
- [Pycord](https://pycord.dev)
- [Pycord docs](https://docs.pycord.dev/en/stable/)
- [discord.py](https://discordpy.readthedocs.io/en/stable/)
- [Discord API](https://discord.com/developers/docs/reference)
- [Hive Code "API"](https://event.withhive.com/ci/smon/evt_coupon)
## Copyright
This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details. <br>
This include all contributions to the project, even from the community.
Copyright © 2024 Okaneeee | Anatole

0 comments on commit e1aea1f

Please sign in to comment.