Skip to content

Commit

Permalink
Finalização da refatoração POSTING
Browse files Browse the repository at this point in the history
Módulo de posting completamente refatorado e código escrito do 0. O objetivo da refatoração é organizar o código e corrigir bugs existentes. Foi adicionado também uma fonte que suporte emoji, para corrigir de forma temporária o problema de identificação de emoji (temporária pois não são todos os emojis que a fonte consegue identificar) enquanto estamos trabalhando para sanar de vez.
  • Loading branch information
rodrigoTcarmo committed Jan 16, 2022
1 parent 90afb1c commit 3ca2ecc
Show file tree
Hide file tree
Showing 60 changed files with 2,521 additions and 471 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
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
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 removed Font/twitterchirp.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
311 changes: 311 additions & 0 deletions Logs/Twitter/logs_posting/INFO/HASHTAG.log

Large diffs are not rendered by default.

1,884 changes: 1,884 additions & 0 deletions Logs/Twitter/logs_posting/INFO/POSTING.log

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions Procfile

This file was deleted.

Binary file not shown.
Binary file removed Twitter/Posting/__pycache__/posting.cpython-38.pyc
Binary file not shown.
Binary file modified Twitter/Posting/__pycache__/posting.cpython-39.pyc
Binary file not shown.
190 changes: 0 additions & 190 deletions Twitter/Posting/new_posting.py

This file was deleted.

Binary file removed Twitter/Posting/posting.png
Binary file not shown.
Loading

0 comments on commit 3ca2ecc

Please sign in to comment.