Compare commits

..

No commits in common. "6977bd58a0342241799fd1700ab4f467ab3f452e" and "e6c44193f82d254193843157f4280076cafd9b19" have entirely different histories.

6 changed files with 3 additions and 216 deletions

154
README.md
View File

@ -1,155 +1,3 @@
# HellMBot # HellMBot
### Discord bot that will wake your friends up from full mute by putting them through 9 circles of hell Discord bot that will wake your friends up from full mute by putting them through 9 circles of hell
![](https://cdn.orudo.ru/.work/trueold89/git/hellm/Header.png)
## Source code:
[<img src="https://cdn.orudo.ru/.work/trueold89/git/hellm/orudo.svg" alt="SVG Image" width="300" height="102" style="padding-right: 10px">](https://git.orudo.ru/trueold89/HellMBot)
[<img src="https://cdn.orudo.ru/.work/trueold89/git/hellm/github.svg" alt="SVG Image" width="300" height="102" style="padding-right: 10px">](https://github.com/Trueold89/HellMBot)
***
![](https://cdn.orudo.ru/.work/trueold89/git/hellm/example.gif)
***
## Usage:
![](https://cdn.orudo.ru/.work/trueold89/git/hellm/faq.png)
---
- **Add bot to your server**
- **Update the bot's permissions to prevent unnecessary people from using its commands (optional)**
- **Type /create in any text chat you want**
- **Write `/create` in whatever text chat you want**
- **Move any user (or yourself, if you're a masochist) to any of the channels in the group created by bot**
- **Have fun!**
## Deploy:
***
### Python venv:
![](https://cdn.orudo.ru/.work/trueold89/git/hellm/python.png)
- **Install python package from [git.orudo.ru](https://git.orudo.ru/trueold89/HellMBot/packages)**:
```shell
pip install pip install --extra-index-url https://git.orudo.ru/api/packages/trueold89/pypi/simple/ HellMBot
```
- **Or build your own package from sources**:
*Clone source code repo:*
```shell
git clone https://git.orudo.ru/trueold89/HellMBot.git && cd HellMBot
```
*Install build deps:*
```shell
pip install setuptools
```
*Build package:*
```shell
python3 setup.py sdist
```
*Install built package:*
```shell
pip install dist/*
```
---
- **Set [system environment variables](#available-system-environment-variables): (Linux bash example)**
```bash
export BOT_TOKEN=insertyourbottokenhere
```
```bash
export CLIENT_ID=insertyourclientidhere
```
---
- **Start bot:**
```shell
heelm
```
***
### Docker:
![](https://cdn.orudo.ru/.work/trueold89/git/hellm/docker.png)
- **Pull image from [git.orudo.ru](https://git.orudo.ru/trueold89/HellMBot/packages)**:
```shell
docker pull git.orudo.ru/trueold89/hellmbot:latest
```
- **Or build your own image:**
*Clone source code repo:*
```shell
git clone https://git.orudo.ru/trueold89/HellMBot.git && cd HellMBot/docker
```
*Edit the Dockerfile with your changes (Optional)*
*Build image:*
```shell
docker build -t hellmbot .
```
---
- **Create docker volume that will use to store DataBase:**
```shell
docker volume create hellm_db
```
---
- **Deploy using docker-cli:**
```shell
docker run \
--name HellMBot\
--restart=unless-stopped \
-v hellm_db:/etc/hellmbot/
-e BOT_TOKEN="insertyourbottokenhere" \
-e CLIENT_ID="insertyourclientidhere" \
-d git.orudo.ru/trueold89/hellmbot:latest
```
- **Or using docker-compose:**
```yml
services:
qbitdl_bot:
image: git.orudo.ru/trueold89/hellmbot:latest
container_name: HellMBot
volumes:
- hellm_db:/etc/hellmbot
restart: 'unless-stopped'
environment:
BOT_TOKEN: "insertyourbottokenhere"
CLIENT_ID: "insertyourclientidhere"
```
```shell
docker compose up -d
```
***
## Available system environment variables
***
- `BOT_TOKEN` - **Discord Bot TOKEN** *[(How to get)](https://discordjs.guide/preparations/setting-up-a-bot-application.html#creating-your-bot)*
- `CLIENT_ID` - **Discord Application ID** *[(How to get)](https://docs.discordadvertising.com/getting-your-application-id)*
- `DB_PATH` - **Path to SQLite DataBase file** *(Optional | Highly recommended to change when running bot on Windows systems) (Default Value: "/etc/hellmbot/database.sqlite")*
- `CIRCLES_COUNT` - **Number of channels the bot creates when the "/create" command is activated.** *(Optional)* *(Default value: 9)*

View File

@ -1,6 +0,0 @@
FROM alpine:latest
RUN apk update && apk add python3 py3-pip
ENV DB_PATH="/etc/hellmbot/database.sqlite"
RUN pip install --extra-index-url https://git.orudo.ru/api/packages/trueold89/pypi/simple/ HellMBot --break-system-packages
WORKDIR /etc/hellmbot
ENTRYPOINT ["hellm"]

View File

@ -1,10 +0,0 @@
services:
qbitdl_bot:
image: git.orudo.ru/trueold89/hellmbot:latest
container_name: HellMBot
volumes:
- hellm_db:/etc/hellmbot
restart: 'unless-stopped'
environment:
BOT_TOKEN: "insertyourbottokenhere"
CLIENT_ID: "insertyourclientidhere"

View File

@ -2,8 +2,7 @@
from hellmbot.env import ENV from hellmbot.env import ENV
from hellmbot.db import ServersDB from hellmbot.db import ServersDB
from discord import Intents, Member, VoiceState, Permissions from discord import Intents, Member, VoiceState
from discord.utils import oauth_url
from discord.ext import commands from discord.ext import commands
@ -18,7 +17,6 @@ def init_bot() -> commands.Bot:
:return: Bot class object :return: Bot class object
""" """
intents = Intents.default() intents = Intents.default()
intents.members = True
intents.message_content = True intents.message_content = True
return commands.Bot(command_prefix="/", intents=intents) return commands.Bot(command_prefix="/", intents=intents)
@ -34,19 +32,6 @@ def start() -> None:
bot.run(ENV.BOT_TOKEN.fget(None)) bot.run(ENV.BOT_TOKEN.fget(None))
@bot.event
async def on_ready() -> None:
"""
Displays a link to add a bot to the server
"""
client_id = ENV.CLIENT_ID.fget(None)
invite = oauth_url(client_id, permissions=Permissions(
manage_channels=True,
move_members=True
))
print(f"Your bot invite link: {invite}")
@bot.command() @bot.command()
async def create(ctx: commands.Context) -> None: async def create(ctx: commands.Context) -> None:
""" """
@ -69,7 +54,7 @@ user_before_channels = {}
@bot.event @bot.event
async def on_voice_state_update(member: Member, before: VoiceState, after: VoiceState) -> None: async def on_voice_state_update(member: Member, before: VoiceState, after: VoiceState):
""" """
Moves the user through the group channels if the user has been connected to one of them Moves the user through the group channels if the user has been connected to one of them

View File

@ -45,17 +45,4 @@ class ENV(object):
env = environ.get("CIRCLES_COUNT") env = environ.get("CIRCLES_COUNT")
if env is None: if env is None:
env = 9 env = 9
return int(env)
@property
def CLIENT_ID(self) -> str:
"""
Gets the Discord Client ID from the system environment
:return: Discord Client ID
"""
env = environ.get("CLIENT_ID")
if env is None:
raise ValueError("client id is not set\nTry to install the system ENV CLIENT_ID\n(export "
"CLIENT_ID=insertyourclientidhere)")
return env return env

View File

@ -1,17 +0,0 @@
# -*- coding: utf-8 -*-
from setuptools import setup
setup(
name="HellMBot",
version="0.1",
url="https://git.orudo.ru/trueold89/HellMBot",
author="trueold89",
author_email="trueold89@orudo.ru",
description="Discord bot that will wake your friends up from full mute by putting them through 9 circles of hell",
packages=["hellmbot"],
long_description=open("README.md").read(),
install_requires=["discord.py"],
entry_points={
"console_scripts": ["hellm = hellmbot.bot:main"]
}
)