Skip to content

Commit

Permalink
Merge pull request #11 from CaioMadeira/dev/refactor-posting
Browse files Browse the repository at this point in the history
Update V3.2.0
  • Loading branch information
rodrigoTcarmo authored Jan 16, 2022
2 parents a9728b0 + 3ca2ecc commit f48f088
Show file tree
Hide file tree
Showing 99 changed files with 2,600 additions and 311 deletions.
4 changes: 3 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ template_posting = "Templates/template.png"

myriad_font = "Font/myriad.otf"

times_font = "Font/myriad.otf"
times_font = "Font/times.ttf"

opensansemoji = "Font/OpenSansEmoji.ttf"

open_quotes = "Twitter/Hashtag/open_quote.png"

Expand Down
Binary file not shown.
Binary file not shown.
49 changes: 0 additions & 49 deletions Credentials/Twitter/PhiloWATCH/philowatch_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,55 +16,6 @@
API SECRET KEY | ACESS TOKEN SECRET
BEARER_TOKEN
"""
# import tweepy
# import os
# from Logs.Twitter.logger_engine import log_philobot
#
# """=========== SET LOG ==========="""
# log = log_philobot(__name__)
#
# """=========== GET KEYs FROM S.O ENV ==========="""
# ACCESS_TOKEN_PW = os.getenv('ACCESS_TOKEN_PW')
#
# ACCESS_SECRET_TOKEN_PW = os.getenv('ACCESS_SECRET_TOKEN_PW')
#
# API_KEY_PW = os.getenv('API_KEY_PW')
#
# API_SECRET_KEY_PW = os.getenv('API_SECRET_KEY_PW')
#
# BEARER_TOKEN_PW = os.getenv('BEARER_TOKEN_PW')
#
#
# AUTH_PW = tweepy.OAuthHandler(API_KEY_PW, API_SECRET_KEY_PW)
# AUTH_PW.set_access_token(ACCESS_TOKEN_PW, ACCESS_SECRET_TOKEN_PW)
#
#
# try:
# API_PW = tweepy.API(auth_handler=AUTH_PW)
#
# except tweepy.TweepError as auth_pw_error:
# log.error('[X] - Erro ao se autenticar com as credenciais de teste!')
# log.error(auth_pw_error)

"""
Philosopher Bot
---------------
Created by Caio Madeira
Co-worker: Rodrigo Carmo
instagram: @sudomadeira
Twitter: @bot_philospher
Avaliable on Discord too!
# --------------------------------------------------------------
ORDER
CONSUMER KEY
CONSUMER SECRET KEY
API KEY | ACESS TOKEN
API SECRET KEY | ACESS TOKEN SECRET
BEARER_TOKEN
"""
import tweepy
import os
Expand Down
Binary file modified Credentials/Twitter/Test/__pycache__/__init__.cpython-39.pyc
Binary file not shown.
Binary file not shown.
6 changes: 0 additions & 6 deletions Credentials/Twitter/Test/test_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@
"""
import os
import tweepy
# import datetime
# from Logs.Twitter.log_engine import log_hashtag

"""=========== SET LOG ==========="""
# log_credential = log_hashtag(__name__)

"""=========== GET KEYs FROM S.O ENV ==========="""
ACCESS_TOKEN_TEST = os.getenv('ACCESS_TOKEN_TEST')
Expand All @@ -45,6 +41,4 @@
API_TEST = tweepy.API(auth_handler=AUTH_API)

except tweepy.TweepError as auth_test:
# log_credential.error('[X] - Erro ao se autenticar com as credenciais de teste!')
# log_credential.error(auth_test)
print('Error')
Binary file modified Credentials/Twitter/__pycache__/__init__.cpython-39.pyc
Binary file not shown.
Binary file modified Credentials/__pycache__/__init__.cpython-39.pyc
Binary file not shown.
4 changes: 2 additions & 2 deletions Discord/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import textwrap
import os
from Lists.img_list import PHILOSOPHERS_LIST
from Templates.New_Img_Manipulation.reference import TEMPLATES_PATH
from Templates.New_Img_Manipulation.path_reference import TEMPLATES_PATH

# loads .env
dotenv.load_dotenv(dotenv.find_dotenv())
Expand Down Expand Up @@ -182,7 +182,7 @@ async def clear(ctx, numero):
@client.command() # função principal
async def philobot(ctx, *, mensagem):
try:
img = Image.open(f'{TEMPLATES_PATH}/layer_1.png')
img = Image.open(f'{TEMPLATES_PATH}/background_image.png')
font = ImageFont.truetype(os.getenv('myriad_font'), 50)
drawing = ImageDraw.Draw(img)

Expand Down
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM python:3.9

WORKDIR /PHILOBOT

COPY . .

RUN pip install -r requirements.txt
Binary file added Font/OpenSansEmoji.ttf
Binary file not shown.
Binary file modified Logs/Twitter/__pycache__/log_engine.cpython-39.pyc
Binary file not shown.
6 changes: 3 additions & 3 deletions Logs/Twitter/log_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def log_hashtag(self):

formatter_bot = logging.Formatter('%(asctime)s - %(levelname)s - HASHTAG --> %(message)s')

file_handler_info = TimedRotatingFileHandler(rf'{PATH_LOG_HASHTAG_INFO}\HASHTAG.log', when='midnight', interval=1)
file_handler_info = TimedRotatingFileHandler(rf'{PATH_LOG_HASHTAG_INFO}\HASHTAG.log', when='midnight', interval=1, encoding='utf8')
file_handler_info.setLevel(logging.DEBUG)
file_handler_info.setFormatter(formatter_bot)

Expand All @@ -47,9 +47,9 @@ def log_posting(self):
log_post = logging.getLogger(self.name)
log_post.setLevel(logging.INFO)

formatter_bot = logging.Formatter('%(asctime)s - %(levelname)s - HASHTAG --> %(message)s')
formatter_bot = logging.Formatter('%(asctime)s - %(levelname)s - POSTING --> %(message)s')

file_handler_info = TimedRotatingFileHandler(rf'{PATH_LOG_POST_INFO}\HASHTAG.log', when='d', interval=1)
file_handler_info = TimedRotatingFileHandler(rf'{PATH_LOG_POST_INFO}\POSTING.log', when='d', interval=1, encoding='utf8')
file_handler_info.setLevel(logging.DEBUG)
file_handler_info.setFormatter(formatter_bot)

Expand Down
Loading

0 comments on commit f48f088

Please sign in to comment.