Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bow #11

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Bow #11

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 30 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,41 @@

a Bot Excelling in Reminding Things

[![DeepSource](https://deepsource.io/gh/TeamNameBE/BERT.svg/?label=active+issues&show_trend=true&token=DdW16C2CB_tWuIDNbxXRm3Lw)](https://deepsource.io/gh/TeamNameBE/BERT/?ref=repository-badge)

## Supported Commands

* **/addreminder** date(jj/mm/yyy) hour(HH:MM) name(no space) duration(HH:MM) peopletoremind(@role)
* creates a reminder at the given date that concerns the mentionned role/user
* **/delreminder** name
* deletes a reminder
* **/modreminder** name parameter(name|start_date|duration|channel|allow_dp) new_value
* Modifies the given field of a reminder
* **/getfuture** [hours|days|weeks] value
* Returns the reminders until the given date (defaults to next week)
* **/help** [command]
* displays help message about the specified command, or about every command
* **/deathping** [@someone]
* Deathping someone (May be multiple people)
* **/stopping** [@someone]
* Stops a deathping on someone
* **/morsty**
* ? ? ?
* **/pic** keywords
* Returns a random picture corresponding to the give keywords
* **/vote** "Question" "proposition 0" ... "proposition 10"
* Creates an embed message for a quick vote
- **/addreminder** date(jj/mm/yyy) hour(HH:MM) name(no space) duration(HH:MM) peopletoremind(@role)
- creates a reminder at the given date that concerns the mentionned role/user
- **/delreminder** name
- deletes a reminder
- **/modreminder** name parameter(name|start_date|duration|channel|allow_dp) new_value
- Modifies the given field of a reminder
- **/getfuture** [hours|days|weeks] value
- Returns the reminders until the given date (defaults to next week)
- **/help** [command]
- displays help message about the specified command, or about every command
- **/deathping** [@someone]
- Deathping someone (May be multiple people)
- **/stopping** [@someone]
- Stops a deathping on someone
- **/morsty**
- ? ? ?
- **/pic** keywords
- Returns a random picture corresponding to the give keywords
- **/vote** "Question" "proposition 0" ... "proposition 10"
- Creates an embed message for a quick vote

## Installation

For development purpose :

```
./setup.sh -d
```

For deployment purpose :

```
virtualenv -p python3 ve/
source ve/bin/activate
pip install -r requirements.txt
./setup.sh
```
2 changes: 2 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import django
from web.app import app

# Django specific settings
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "src.settings")
Expand All @@ -22,6 +23,7 @@ def main():
client = Bert.getInstance()
ReminderCog.getInstance() # Start the cog

client.loop.create_task(app.run_task('0.0.0.0'))
client.run(API_KEY)


Expand Down
31 changes: 0 additions & 31 deletions requirements.txt

This file was deleted.

6 changes: 6 additions & 0 deletions requirements/build_requirements.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
pip-compile requirements/requirements.in

if [ "$1" == "dev" ]; then
pip-compile requirements/requirements-dev.in
fi
4 changes: 4 additions & 0 deletions requirements/requirements-dev.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pip-tools
flake8
black
rope
42 changes: 42 additions & 0 deletions requirements/requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#
# This file is autogenerated by pip-compile with python 3.9
# To update, run:
#
# pip-compile requirements/requirements-dev.in
#
appdirs==1.4.4
# via black
black==21.6b0
# via -r requirements/requirements-dev.in
click==8.0.1
# via
# black
# pip-tools
flake8==3.9.2
# via -r requirements/requirements-dev.in
mccabe==0.6.1
# via flake8
mypy-extensions==0.4.3
# via black
pathspec==0.8.1
# via black
pep517==0.10.0
# via pip-tools
pip-tools==6.2.0
# via -r requirements/requirements-dev.in
pycodestyle==2.7.0
# via flake8
pyflakes==2.3.1
# via flake8
regex==2021.4.4
# via black
rope==0.19.0
# via -r requirements/requirements-dev.in
toml==0.10.2
# via black
wheel==0.36.2
# via pip-tools

# The following packages are considered to be unsafe in a requirements file:
# pip
# setuptools
8 changes: 8 additions & 0 deletions requirements/requirements.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
quart
discord.py
django
emoji
psycopg2-binary
quart
requests
discord-py-slash-command
84 changes: 84 additions & 0 deletions requirements/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#
# This file is autogenerated by pip-compile with python 3.9
# To update, run:
#
# pip-compile requirements/requirements.in
#
aiofiles==0.7.0
# via quart
aiohttp==3.7.4.post0
# via discord.py
asgiref==3.4.0
# via django
async-timeout==3.0.1
# via aiohttp
attrs==21.2.0
# via aiohttp
blinker==1.4
# via quart
certifi==2021.5.30
# via requests
chardet==4.0.0
# via
# aiohttp
# requests
click==8.0.1
# via quart
discord.py==1.7.3
# via -r requirements/requirements.in
django==3.2.4
# via -r requirements/requirements.in
emoji==1.2.0
# via -r requirements/requirements.in
h11==0.12.0
# via
# hypercorn
# wsproto
h2==4.0.0
# via hypercorn
hpack==4.0.0
# via h2
hypercorn==0.11.2
# via quart
hyperframe==6.0.1
# via h2
idna==2.10
# via
# requests
# yarl
itsdangerous==2.0.1
# via quart
jinja2==3.0.1
# via quart
markupsafe==2.0.1
# via jinja2
multidict==5.1.0
# via
# aiohttp
# yarl
priority==2.0.0
# via hypercorn
psycopg2-binary==2.9.1
# via -r requirements/requirements.in
pytz==2021.1
# via django
quart==0.15.1
# via -r requirements/requirements.in
requests==2.25.1
# via -r requirements/requirements.in
sqlparse==0.4.1
# via django
toml==0.10.2
# via
# hypercorn
# quart
typing-extensions==3.10.0.0
# via aiohttp
urllib3==1.26.6
# via requests
werkzeug==2.0.1
# via quart
wsproto==1.0.0
# via hypercorn
yarl==1.6.3
# via aiohttp
54 changes: 54 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Usage documentation
usage() { echo "Usage: $0 [-d] [-f]" 1>&2; exit 1; }

help () {
echo "Options :"
echo " -f Force Forces the recreation of the requirements files"
echo " -d Development Builds the development requirements and install them as well"
exit
}

while getopts "dfh" option; do
case ${option} in
f )
FORCE="true"
;;
d )
DEV="true"
;;
h )
help
;;
\? ) #For invalid option
usage
;;
esac
done

# Try venv installation
{
python3 -m venv ve
} || {
echo "Unable to create a virtual environment, make sure python3-virtualenv is installed !"
}

source ve/bin/activate

# Build requirements if needed
if [ ! -e requirements/requirements.txt ] || ([ ! -e requirements/requirements-dev.txt ] && [ "$DEV" == "true" ]) || [ "$FORCE" == "true" ]; then
pip install pip-tools

if [ "$DEV" == "true" ]; then
./requirements/build_requirements.sh dev
else
./requirements/build_requirements.sh
fi
fi

# Install requirements
pip install -r requirements/requirements.txt
if [ "$DEV" == "true" ]; then
pip install -r requirements/requirements-dev.txt
fi

./manage.py migrate
21 changes: 21 additions & 0 deletions web/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from quart import Quart

from singleton.client import Bert


app = Quart(__name__)


@app.route("/api/servers/list")
async def server_list():
client = Bert.getInstance()
servers = []

for guild in client.guilds:
servers.append({
"name": guild.name,
"id": guild.id,
"icon": str(guild.icon_url)
})

return {"servers": servers}