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

IP and email scoring bot #1

Open
wants to merge 11 commits into
base: 7.0.x
Choose a base branch
from
Prev Previous commit
Next Next commit
Remove redundant DomainInfo dataclass
  • Loading branch information
Kufat committed Feb 1, 2021
commit cd1a28013cc0668132351b16d867aa796ffb58d5
17 changes: 6 additions & 11 deletions sopel/modules/emailcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,6 @@ def __str__(self):
def __post_init__(self):
self.domain = self.domain.lower()

@dataclass
class DomainInfo:
flag_valid: bool
flag_disposable: bool

def alert(bot, alert_msg: str, log_err: bool = False):
for channel in bot.config.emailcheck.warn_chans:
bot.say(alert_msg, channel)
Expand Down Expand Up @@ -235,14 +230,14 @@ def get_email_info_from_db(session, email):
.one_or_none()
if query_result:
#Any known problematic provider should've been BADMAILed by now, but...
return DomainInfo(query_result.flag_valid,
query_result.flag_disposable)
return ValidatorPizzaResponse(flag_valid=query_result.flag_valid,
flag_disposable=query_result.flag_disposable)

def store_email_info_in_db(session, email, nick, result):
new_known_email = KnownEmails(domain= email.domain[:DOMAIN_LEN],
first_nick= nick,
flag_valid= result.flag_valid,
flag_disposable= result.flag_disposable)
new_known_email = KnownEmails(domain=email.domain[:DOMAIN_LEN],
first_nick=nick,
flag_valid=result.flag_valid,
flag_disposable=result.flag_disposable)
session.add(new_known_email)

def retrieve_info_for_email(bot, email, nick):
Expand Down