-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- resolving the module error - refactoring the formating library - producer and consumer broker scripts. - discord bot scripts and docker deployments.
- Loading branch information
1 parent
e4c99c3
commit 6357a47
Showing
13 changed files
with
115 additions
and
204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import logging | ||
|
||
class LoggingFormatter(logging.Formatter): | ||
# Colors | ||
black = "\x1b[30m" | ||
red = "\x1b[31m" | ||
green = "\x1b[32m" | ||
yellow = "\x1b[33m" | ||
blue = "\x1b[34m" | ||
gray = "\x1b[38m" | ||
# Styles | ||
reset = "\x1b[0m" | ||
bold = "\x1b[1m" | ||
|
||
COLORS = { | ||
logging.DEBUG: gray + bold, | ||
logging.INFO: blue + bold, | ||
logging.WARNING: yellow + bold, | ||
logging.ERROR: red, | ||
logging.CRITICAL: red + bold, | ||
} | ||
|
||
def format(self, record): | ||
log_color = self.COLORS[record.levelno] | ||
format = "(black){asctime}(reset) (levelcolor){levelname:<8}(reset) (green){name}(reset) {message}" | ||
format = format.replace("(black)", self.black + self.bold) | ||
format = format.replace("(reset)", self.reset) | ||
format = format.replace("(levelcolor)", log_color) | ||
format = format.replace("(green)", self.green + self.bold) | ||
formatter = logging.Formatter(format, "%Y-%m-%d %H:%M:%S", style="{") | ||
return formatter.format(record) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
FROM --platform=linux/amd64 python:3.11.1 as build | ||
|
||
RUN mkdir -p /usr/src/app/bots/ | ||
COPY requirements.txt /usr/src/app/bots/requirements.txt | ||
|
||
|
||
WORKDIR /usr/src/app/bots/ | ||
|
||
|
||
RUN pip install --upgrade pip && pip install -r requirements.txt | ||
|
||
ENV PATH=" ${PATH}:/root/.local/bin" | ||
|
||
## copying the remaining folders for circumbot deployment. | ||
COPY . . | ||
|
||
## also .env separately from the root folder | ||
|
||
COPY ../../.env ../../.env | ||
|
||
FROM build as run | ||
|
||
|
||
COPY --from=build /usr/src/app/bots/ /usr/src/app/bots/ | ||
|
||
WORKDIR /usr/src/app/bots/Discord | ||
|
||
CMD [ "python3", "circombot.py" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
""" | ||
microservices and packages consisting of telegram and discord bots are deployed here. | ||
""" | ||
""" | ||
|
||
import sys | ||
import os | ||
sys.path.append('.') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
""" | ||
functions for consuming the message generated from the given broker package to the discord result. | ||
""" | ||
""" | ||
|
||
import sys | ||
sys.path.append('..') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
"script in order to import the functions for generating messages from bot to the brokers" | ||
"script in order to import the functions for generating messages from bot to the brokers" | ||
|
||
import sys | ||
sys.path.append('..') |
Oops, something went wrong.