Skip to content

Commit 35ac28a

Browse files
committed
Merge branch 'master' into dp/add-bokken-connection
2 parents 0031332 + 2a0d318 commit 35ac28a

File tree

13 files changed

+94
-199
lines changed

13 files changed

+94
-199
lines changed

.python-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.10.4
1+
3.10.7

:w

Lines changed: 0 additions & 186 deletions
This file was deleted.

bin/server

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,39 @@ cd "${BASE_DIR}/.." || exit 127
1010
# shellcheck source=../scripts/utils.sh
1111
. scripts/utils.sh
1212

13+
PROGRAM=$(basename "${BASH_SOURCE[0]:-$0}")
14+
VERSION=0.7.0
15+
16+
function display_help() {
17+
cat <<EOF
18+
$(help_title_section Usage)
19+
${PROGRAM} [options]
20+
21+
$(help_title_section Options)
22+
-h --help Show this screen.
23+
-v --version Show version.
24+
EOF
25+
}
26+
27+
while [ ! $# -eq 0 ]; do
28+
case "$1" in
29+
-h | --help)
30+
display_help
31+
exit 0
32+
;;
33+
-v | --version)
34+
display_version "${VERSION}" "${PROGRAM}"
35+
exit 0
36+
;;
37+
*)
38+
display_help >&2
39+
exit 1
40+
;;
41+
esac
42+
43+
shift
44+
done
45+
1346
source .venv/bin/activate
1447

1548
python3 -m bot

bin/setup

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,39 @@ cd "${BASE_DIR}/.." || exit 127
1010
# shellcheck source=../scripts/utils.sh
1111
. scripts/utils.sh
1212

13+
PROGRAM=$(basename "${BASH_SOURCE[0]:-$0}")
14+
VERSION=0.7.0
15+
16+
function display_help() {
17+
cat <<EOF
18+
$(help_title_section Usage)
19+
${PROGRAM} [options]
20+
21+
$(help_title_section Options)
22+
-h --help Show this screen.
23+
-v --version Show version.
24+
EOF
25+
}
26+
27+
while [ ! $# -eq 0 ]; do
28+
case "$1" in
29+
-h | --help)
30+
display_help
31+
exit 0
32+
;;
33+
-v | --version)
34+
display_version "${VERSION}" "${PROGRAM}"
35+
exit 0
36+
;;
37+
*)
38+
display_help >&2
39+
exit 1
40+
;;
41+
esac
42+
43+
shift
44+
done
45+
1346
if not_installed "asdf"; then
1447
echo_warning "
1548
We are using asdf (https://github.com/asdf-vm/asdf) to manage tool
@@ -28,7 +61,7 @@ fi
2861
log_info "setup" "Setting up the env file..."
2962
if [ ! -f .env ]; then
3063
cp .env.sample .env
31-
log_done "env file created, you might want to open .env and set the correct values..."
64+
log_success "env file created, you might want to open .env and set the correct values..."
3265
echo
3366
else
3467
log_warn ".env file already exists, skipping..."

bot/client.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import logging
2+
import sys
23

34
import discord
45
from discord.ext import commands
@@ -13,7 +14,7 @@
1314
case_insensitive=True,
1415
)
1516

16-
# Logging setup
17+
# Logging to file
1718
logger = logging.getLogger("discord")
1819
logger.setLevel(logging.INFO)
1920
handler = logging.FileHandler(
@@ -24,14 +25,21 @@
2425
)
2526
logger.addHandler(handler)
2627

28+
# Logging to stdout
29+
stdout_handler = logging.StreamHandler(sys.stdout)
30+
stdout_handler.setFormatter(
31+
logging.Formatter("%(asctime)s:%(levelname)s:%(name)s: %(message)s")
32+
)
33+
logger.addHandler(stdout_handler)
34+
2735

2836
@client.event
2937
async def on_ready():
3038
"""Client event that run when the program is ready."""
3139

32-
logger.info("The bot was logged in")
40+
logger.info("The bot was logged in")
3341
DailyReport(client).report.start()
34-
logger.info("The task has been loaded")
42+
logger.info("The bot is ready 🚀")
3543

3644

3745
@client.command()

bot/cogs/belts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ async def promove(
6161
# Adding the log to the database
6262
asyncio.create_task(self.log(ctx, member, belt))
6363
else:
64-
await ctx.send(
64+
await ctx.reply(
6565
f"Ocorreu um erro ao atualizar o cinturão do ninja {user} no site :(\nPor favor tente mais tarde."
6666
)
6767

requirements-dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ ipython==8.4.0
33
isort==5.10.1
44
mypy==0.971
55
mypy-extensions==0.4.3
6-
pre-commit==2.20.0
6+
pre-commit==3.1.1
77
pylint==2.14.5
88
python-dotenv==0.20.0

scripts/colors.sh

100644100755
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#!/bin/sh -n
2+
13
RED=$(tput setaf 1)
24
ORANGE=$(tput setaf 3)
35
GREEN=$(tput setaf 2)

scripts/extras.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,4 +133,4 @@ function execute() {
133133
return $exitCode
134134
}
135135

136-
[ "$0" = "${BASH_SOURCE[0]}" ] && display_version 0.5.6 || true
136+
[ "$0" = "${BASH_SOURCE[0]}" ] && display_version 0.7.0 || true

scripts/fmt.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,4 +129,4 @@ function format() {
129129
fi
130130
}
131131

132-
[ "$0" = "${BASH_SOURCE[0]}" ] && display_version 0.5.6 || true
132+
[ "$0" = "${BASH_SOURCE[0]}" ] && display_version 0.7.0 || true

0 commit comments

Comments
 (0)