reload(tools.smart_start_stream_time)
logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
PATH = os.path.dirname(os.path.realpath(__file__))
logger.debug(f"analyze_auto_message PATH set to: {PATH}")
from aptbot.bot import Bot, Message, Commands
logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler('/var/log/aptbot/logs.log')
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
PATH = os.path.dirname(os.path.realpath(__file__))
logger.debug(f"PATH set to: {PATH}")
replied_message = None
if replied_message:
- command = message.value.split(' ')[1]
+ command = message.value.split(" ")[1]
else:
- command = message.value.split(' ')[0]
+ command = message.value.split(" ")[0]
prefix = command[0]
command = command[1:]
user_id = message.tags["user-id"]
command,
prefix,
user_perm,
- )
+ ),
)
fetched = c.fetchall()
if not fetched:
conn.close()
return
- (_, value,
- command_user_cooldown,
- command_global_cooldown,
- avail_time) = random.choice(fetched)
+ (
+ _,
+ value,
+ command_user_cooldown,
+ command_global_cooldown,
+ avail_time,
+ ) = random.choice(fetched)
if message_timestamp < avail_time:
bot.send_privmsg(
message.channel,
f"The command '{prefix}{command}' is on cooldown. \
- Please wait {int(avail_time - message_timestamp) + 1} seconds."
+ Please wait {int(avail_time - message_timestamp) + 1} seconds.",
)
conn.close()
return
user_id,
command,
command_user_cooldown + message_timestamp,
- )
+ ),
)
c.execute(
"UPDATE commands SET last_used = ? WHERE command = ?",
(
message_timestamp,
command,
- )
+ ),
)
conn.commit()
conn.close()
def main(bot: Bot, message: Message):
msg = "peepoWave"
bot.send_privmsg(message.channel, msg)
-
video = yt_api.videos.get_newest_video(CHANNEL_ID)
if video:
video_link = f"https://www.youtube.com/watch?v={video.video_id}"
- msg = f"Watch Peks' latest video \"{video.video_name}\" here: {video_link}"
+ msg = f'Watch Peks\' latest video "{video.video_name}" here: {video_link}'
else:
msg = f"Check out my youtube channel here -> https://www.youtube.com/channel/{CHANNEL_ID}"
bot.send_privmsg(message.channel, msg)
import ttv_api.users
logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
PERMISSION = 10
import os
PERMISSION = 10
-PREFIX = '\\'
+PREFIX = "\\"
DESCRIPTION = ""
USER_COOLDOWN = 0
GLOBAL_COOLDOWN = 0
def main(bot: Bot, message: Message):
- msg = ' '.join(message.value.split(' ')[1:])
- command = msg.split(' ')[0]
+ msg = " ".join(message.value.split(" ")[1:])
+ command = msg.split(" ")[0]
command_prefix = command[0]
command_name = command[1:]
- command_value = msg = ' '.join(msg.split(' ')[1:])
- if command_prefix != '?':
+ command_value = msg = " ".join(msg.split(" ")[1:])
+ if command_prefix != "?":
bot.send_privmsg(
message.channel,
- f"{message.nick} you cannot use {command_prefix} as a prefix"
+ f"{message.nick} you cannot use {command_prefix} as a prefix",
)
return
(
command_name,
command_prefix,
- )
+ ),
)
try:
if not c.fetchone()[0]:
bot.send_privmsg(
message.channel,
- f"The command {command_prefix}{command_name} already exists"
+ f"The command {command_prefix}{command_name} already exists",
)
return
except TypeError:
DEFAULT_USER_COOLDOWN,
DEFAULT_GLOBAL_COOLDOWN,
DEFAULT_LAST_USED,
- )
+ ),
)
except sqlite3.IntegrityError:
pass
except Exception as e:
- bot.send_privmsg(
- message.channel,
- f"There was an error adding the command: {e}"
- )
+ bot.send_privmsg(message.channel, f"There was an error adding the command: {e}")
conn.close()
return
c.execute(
(
command_name,
command_value,
- )
- )
- bot.send_privmsg(
- message.channel,
- f"Successfully added {command_name}."
+ ),
)
+ bot.send_privmsg(message.channel, f"Successfully added {command_name}.")
conn.commit()
conn.close()
import time
logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
PERMISSION = 10
PREFIX = "\\"
import random
PERMISSION = 99
-PREFIX = '?'
-DESCRIPTION = r"Tosses a coin, there's a 50% chance it's heads and a 50% chance it's tails"
+PREFIX = "?"
+DESCRIPTION = (
+ r"Tosses a coin, there's a 50% chance it's heads and a 50% chance it's tails"
+)
USER_COOLDOWN = 10
GLOBAL_COOLDOWN = 5
def main(bot: Bot, message: Message):
r = random.random()
if r < 0.02:
- tools.smart_privmsg.send(bot, message, f"the coin landed on it's side, try again.", reply=message.tags["id"])
+ tools.smart_privmsg.send(
+ bot,
+ message,
+ f"the coin landed on it's side, try again.",
+ reply=message.tags["id"],
+ )
elif r < 0.51:
tools.smart_privmsg.send(bot, message, f"heads", reply=message.tags["id"])
else:
tools.smart_privmsg.send(bot, message, f"tails", reply=message.tags["id"])
-
-
import os
PERMISSION = 99
-PREFIX = '?'
+PREFIX = "?"
DESCRIPTION = ""
USER_COOLDOWN = 30
GLOBAL_COOLDOWN = 15
conn = sqlite3.connect(os.path.join(PATH, "database.db"))
c = conn.cursor()
- user_perm = tools.permissions.get_permission_from_id(
- message.tags["user-id"]
- )
+ user_perm = tools.permissions.get_permission_from_id(message.tags["user-id"])
c.execute(
"SELECT prefix, command FROM commands WHERE permission >= ? ORDER BY permission ASC",
- (
- user_perm,
- )
+ (user_perm,),
)
fetched_commands = c.fetchall()
for command in fetched_commands:
commands.append(f"{command[0]}{command[1]}")
- commands = ' '.join(commands)
+ commands = " ".join(commands)
tools.smart_privmsg.send(bot, message, commands)
from aptbot.bot import Message, Commands, Bot
PERMISSION = 10
-PREFIX = '\\'
+PREFIX = "\\"
DESCRIPTION = "Reply to a message with \\delete to delete that message"
USER_COOLDOWN = 0
GLOBAL_COOLDOWN = 0
+
def main(bot: Bot, message: Message):
try:
replied_msg_id = message.tags["reply-parent-msg-id"]
return
delete = f"/delete {replied_msg_id}"
bot.send_privmsg(message.channel, delete)
-
import os
PERMISSION = 10
-PREFIX = '\\'
+PREFIX = "\\"
DESCRIPTION = ""
USER_COOLDOWN = 0
GLOBAL_COOLDOWN = 0
def main(bot: Bot, message: Message):
- msg = ' '.join(message.value.split(' ')[1:])
- command = msg.split(' ')[0]
+ msg = " ".join(message.value.split(" ")[1:])
+ command = msg.split(" ")[0]
command_prefix = command[0]
command_name = command[1:]
- command_value = msg = ' '.join(msg.split(' ')[1:])
- if command_prefix != '?':
+ command_value = msg = " ".join(msg.split(" ")[1:])
+ if command_prefix != "?":
bot.send_privmsg(
message.channel,
- f"{message.nick} you cannot use {command_prefix} as a prefix"
+ f"{message.nick} you cannot use {command_prefix} as a prefix",
)
return
(
command_name,
command_prefix,
- )
+ ),
)
if not c.fetchone()[0]:
bot.send_privmsg(
message.channel,
- f"The command {command_prefix}{command_name} cannot be edited"
+ f"The command {command_prefix}{command_name} cannot be edited",
)
return
(
command_value,
command_name,
- )
+ ),
)
except sqlite3.IntegrityError:
- bot.send_privmsg(
- message.channel,
- f"The command {command_name} doesn't exist."
- )
+ bot.send_privmsg(message.channel, f"The command {command_name} doesn't exist.")
else:
- bot.send_privmsg(
- message.channel,
- f"Successfully updated {command_name}."
- )
+ bot.send_privmsg(message.channel, f"Successfully updated {command_name}.")
conn.commit()
conn.close()
import urllib3
PERMISSION = 99
-PREFIX = '?'
+PREFIX = "?"
DESCRIPTION = ""
USER_COOLDOWN = 90
GLOBAL_COOLDOWN = 60
message.channel,
"NotLikeThis oopsie woopsie, we've made a fucky wucky. We can't \
get the emotes at the moment. Hopefuwwy UwU wiww wait patientwy \
- tiww we get thiws pwobwem sowted. OwO"
+ tiww we get thiws pwobwem sowted. OwO",
)
return
emotes = r1.data.decode("utf-8")
import time
logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
PERMISSION = 10
PREFIX = "\\"
import sqlite3
logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
PERMISSION = 10
PREFIX = "\\"
import sqlite3
logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
PERMISSION = 10
PREFIX = "\\"
import time
logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
PERMISSION = 10
PREFIX = "\\"
import time
logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
PERMISSION = 99
PREFIX = "?"
import sqlite3
logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
PERMISSION = 99
PREFIX = "?"
import datetime as dt
PERMISSION = 99
-PREFIX = '?'
+PREFIX = "?"
DESCRIPTION = ""
USER_COOLDOWN = 15
GLOBAL_COOLDOWN = 5
STREAM_SCHEDULE = dt.time(17, 30)
+
def main(bot: Bot, message: Message):
start_stream_ts = tools.smart_start_stream_time.start_stream_timestamp()
if not start_stream_ts:
return
start_stream_dt = datetime.utcfromtimestamp(start_stream_ts)
- stream_schedule_dt = datetime.combine(datetime.utcfromtimestamp(start_stream_ts), STREAM_SCHEDULE)
+ stream_schedule_dt = datetime.combine(
+ datetime.utcfromtimestamp(start_stream_ts), STREAM_SCHEDULE
+ )
latege_amount = (start_stream_dt - stream_schedule_dt).total_seconds()
if latege_amount > 45 * 60:
msg = f"{message.channel} is so Latege he might as well have not \
msg = f"UNBELIEVABLE!!!!! {message.channel} is EARLY by {-latege_amount} seconds!!!!\
This has NEVER happened before POGGERS"
bot.send_privmsg(message.channel, msg)
-
import sqlite3
logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
PERMISSION = 99
PREFIX = "?"
import sqlite3
logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
PERMISSION = 10
PREFIX = "\\"
import sqlite3
logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
PERMISSION = 10
PREFIX = "\\"
import random
logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
PERMISSION = 10
PREFIX = "\\"
import time
logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
PERMISSION = 99
PREFIX = "?"
from tools import smart_privmsg
logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
PERMISSION = 99
import tools.smart_privmsg
logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
PERMISSION = 99
PREFIX = "?"
import os
PERMISSION = 10
-PREFIX = '\\'
+PREFIX = "\\"
DESCRIPTION = ""
USER_COOLDOWN = 0
GLOBAL_COOLDOWN = 0
def main(bot: Bot, message: Message):
- msg = ' '.join(message.value.split(' ')[1:])
- command = msg.split(' ')[0]
+ msg = " ".join(message.value.split(" ")[1:])
+ command = msg.split(" ")[0]
command_prefix = command[0]
command_name = command[1:]
conn = sqlite3.connect(os.path.join(PATH, "database.db"))
c = conn.cursor()
- c.execute(
- "SELECT value FROM command_values WHERE command = ?",
- (
- command_name,
- )
- )
+ c.execute("SELECT value FROM command_values WHERE command = ?", (command_name,))
command_path = os.path.join(COMMANDS_PATH, f"{command_name}.py")
hidden_command_path = os.path.join(COMMANDS_PATH, f".{command_name}.py")
try:
(
command_name,
command_prefix,
- )
+ ),
)
except sqlite3.IntegrityError:
- bot.send_privmsg(
- message.channel,
- f"The command {command_name} doesn't exist."
- )
+ bot.send_privmsg(message.channel, f"The command {command_name} doesn't exist.")
else:
- bot.send_privmsg(
- message.channel,
- f"Successfully removed {command_name}."
- )
+ bot.send_privmsg(message.channel, f"Successfully removed {command_name}.")
conn.commit()
conn.close()
from aptbot.bot import Message, Commands, Bot
PERMISSION = 99
-PREFIX = '?'
+PREFIX = "?"
DESCRIPTION = ""
USER_COOLDOWN = 10
GLOBAL_COOLDOWN = 10
import tools.smart_privmsg
PERMISSION = 99
-PREFIX = '?'
+PREFIX = "?"
DESCRIPTION = ""
USER_COOLDOWN = 30
GLOBAL_COOLDOWN = 15
if replied_message:
msg = replied_message
else:
- msg = ' '.join(message.value.split(' ')[1:])
+ msg = " ".join(message.value.split(" ")[1:])
new_msg = ""
while len(new_msg) + len(msg) < MAX_LENGTH:
new_msg += msg + " "
import scripts.translator
PERMISSION = 99
-PREFIX = '?'
+PREFIX = "?"
DESCRIPTION = "Translates a message from any language (supported by google translate) into English. How to use: ?t <insert text to translate>"
USER_COOLDOWN = 15
GLOBAL_COOLDOWN = 5
msg = replied_message
replied_msg_id = message.tags["reply-parent-msg-id"]
else:
- msg = ' '.join(message.value.split(' ')[1:])
+ msg = " ".join(message.value.split(" ")[1:])
replied_msg_id = None
trans = scripts.translator.translate(msg)
print(trans)
import tools.smart_privmsg
logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
PERMISSION = 99
PREFIX = "?"
import sqlite3
logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
PERMISSION = 10
PREFIX = "\\"
from tools import smart_privmsg
logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler('/var/log/aptbot/logs.log')
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
PERMISSION = 99
-PREFIX = '?'
+PREFIX = "?"
DESCRIPTION = ""
USER_COOLDOWN = 0
GLOBAL_COOLDOWN = 0
def main(bot: Bot, message: Message):
if message.tags.get("reply-parent-display-name", None):
- smart_privmsg.send(bot, message, f"{message.tags['reply-parent-display-name']}, {message.nick} is UwUing you. Will you UwU back? PauseChamp", reply=message.tags['reply-parent-msg-id'])
+ smart_privmsg.send(
+ bot,
+ message,
+ f"{message.tags['reply-parent-display-name']}, {message.nick} is UwUing you. Will you UwU back? PauseChamp",
+ reply=message.tags["reply-parent-msg-id"],
+ )
return
try:
- user = message.value.split(' ')[1]
+ user = message.value.split(" ")[1]
except IndexError:
- smart_privmsg.send(bot, message, f"UwU to you too {message.nick}!", reply=message.tags["id"])
+ smart_privmsg.send(
+ bot, message, f"UwU to you too {message.nick}!", reply=message.tags["id"]
+ )
return
else:
- smart_privmsg.send(bot, message, f"{user}, {message.nick} is UwUing you. Will you UwU back? PauseChamp")
+ smart_privmsg.send(
+ bot,
+ message,
+ f"{user}, {message.nick} is UwUing you. Will you UwU back? PauseChamp",
+ )
return
import yt_api.videos
PERMISSION = 99
-PREFIX = '?'
+PREFIX = "?"
DESCRIPTION = "Get my newest video! Just type ?video"
USER_COOLDOWN = 15
GLOBAL_COOLDOWN = 15
video = yt_api.videos.get_newest_video(CHANNEL_ID)
if video:
video_link = f"https://www.youtube.com/watch?v={video.video_id}"
- msg = f"Watch Peks' latest video \"{video.video_name}\" here: {video_link}"
+ msg = f'Watch Peks\' latest video "{video.video_name}" here: {video_link}'
else:
msg = f"Check out my youtube channel here -> https://www.youtube.com/channel/{CHANNEL_ID}"
bot.send_privmsg(message.channel, msg)
import logging
logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler('/var/log/aptbot/logs.log')
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
PATH = os.path.dirname(os.path.realpath(__file__))
logger.debug(f"PATH set to: {PATH}")
def create_variables_db():
- db_name_var = "variables.db"
+ db_name_var = "variables.db"
conn = sqlite3.connect(os.path.join(PATH, db_name_var))
c = conn.cursor()
logger.info(f"connected to database {db_name_var}")
conn.commit()
conn.close()
+
def create_lol_database():
db_name_database = "lol_data.db"
conn = sqlite3.connect(os.path.join(PATH, db_name_database))
conn.commit()
conn.close()
+
def create_database():
db_name_database = "database.db"
conn = sqlite3.connect(os.path.join(PATH, db_name_database))
aptbot_id = ttv_api.users.get_users(user_logins=["murphyai"])
broadcaster_id = ttv_api.users.get_users(user_logins=[streamer_login])
if admin_id:
- c.execute("INSERT OR IGNORE INTO users VALUES (?, ?)",
- (admin_id[0].user_id, 0))
+ c.execute("INSERT OR IGNORE INTO users VALUES (?, ?)", (admin_id[0].user_id, 0))
logger.info(f"inserted user {admin_id[0].user_id} with permission {0}")
if aptbot_id:
- c.execute("INSERT OR IGNORE INTO users VALUES (?, ?)",
- (aptbot_id[0].user_id, 0))
+ c.execute(
+ "INSERT OR IGNORE INTO users VALUES (?, ?)", (aptbot_id[0].user_id, 0)
+ )
logger.info(f"inserted user {aptbot_id[0].user_id} with permission {0}")
if broadcaster_id:
- c.execute("INSERT OR IGNORE INTO users VALUES (?, ?)",
- (broadcaster_id[0].user_id, 1))
+ c.execute(
+ "INSERT OR IGNORE INTO users VALUES (?, ?)", (broadcaster_id[0].user_id, 1)
+ )
logger.info(f"inserted user {broadcaster_id[0].user_id} with permission {1}")
c.execute(
logger.info(f"connected to database {db_name_database}")
for command in commands:
- command_name = command.split('.')[0]
+ command_name = command.split(".")[0]
command_permission = modules[command_name].PERMISSION
command_prefix = modules[command_name].PREFIX
command_description = modules[command_name].DESCRIPTION
command_user_cooldown,
command_global_cooldown,
command_last_used,
- )
+ ),
)
logger.info(f"updating commands command_name: {command_name}")
logger.debug(f"updating commands command_prefix: {command_prefix}")
logger.debug(f"updating commands command_permission: {command_permission}")
logger.debug(f"updating commands command_description: {command_description}")
- logger.debug(f"updating commands command_user_cooldown: {command_user_cooldown}")
- logger.debug(f"updating commands command_global_cooldown: {command_global_cooldown}")
+ logger.debug(
+ f"updating commands command_user_cooldown: {command_user_cooldown}"
+ )
+ logger.debug(
+ f"updating commands command_global_cooldown: {command_global_cooldown}"
+ )
logger.debug(f"updating commands command_last_used: {command_last_used}")
conn.commit()
conn.close()
+
def add_message_to_chat_history(message: Message):
if message.command != Commands.PRIVMSG:
return
rp_display_name = message.tags["reply-parent-display-name"]
rp_msg_body = message.tags["reply-parent-msg-body"]
rp_msg_id = message.tags["reply-parent-msg-id"]
- rp_user_id = int( message.tags["reply-parent-user-id"] )
+ rp_user_id = int(message.tags["reply-parent-user-id"])
rp_user_login = message.tags["reply-parent-user-login"]
except KeyError:
rp_display_name = None
message.tags["color"],
message.tags["display-name"],
int(message.tags["first-msg"]),
- int( message.tags["mod"] ),
- int( message.tags["room-id"] ),
- int( message.tags["user-id"] ),
+ int(message.tags["mod"]),
+ int(message.tags["room-id"]),
+ int(message.tags["user-id"]),
message.tags["user-type"],
- int( message.tags["turbo"] ),
- int( message.tags["subscriber"] ),
+ int(message.tags["turbo"]),
+ int(message.tags["subscriber"]),
rp_display_name,
rp_msg_body,
rp_msg_id,
rp_user_id,
rp_user_login,
- )
+ ),
)
conn.commit()
conn.close()
+
def create_chat_history_database():
conn = sqlite3.connect(os.path.join(PATH, "chat_history.db"))
c = conn.cursor()
c = conn.cursor()
for auto_message in auto_messages:
- auto_message_name = auto_message.split('.')[0]
+ auto_message_name = auto_message.split(".")[0]
auto_message_cooldown = modules[auto_message_name].COOLDOWN
auto_message_end_time = modules[auto_message_name].END_TIME
auto_message_last_used = 0
auto_message_cooldown,
auto_message_end_time,
auto_message_last_used,
- )
+ ),
)
except Exception as e:
c.execute(
auto_message_cooldown,
auto_message_end_time,
auto_message_name,
- )
+ ),
)
conn.commit()
conn.close()
from lol_api import *
logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler('/var/log/aptbot/logs.log')
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
-
-
from typing import Optional
logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
@dataclass
from lol_api import *
logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler('/var/log/aptbot/logs.log')
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
@dataclass
revision_date: int
summoner_level: int
+
def get_summoner_from_puuid(puuid: str) -> Optional[Summoner]:
endpoint = f"/lol/summoner/v4/summoners/by-puuid/{puuid}"
url = BASE_URL + endpoint
headers=HEADER,
)
if r.status != 200:
- logger.warning(f"Couldn't retrieve summoner with puuid: {puuid}. Status code {r.status}")
+ logger.warning(
+ f"Couldn't retrieve summoner with puuid: {puuid}. Status code {r.status}"
+ )
return None
data = json.loads(r.data.decode("utf-8"))
return Summoner(
data["name"],
data["profileIconId"],
data["revisionDate"],
- data["summonerLevel"]
+ data["summonerLevel"],
)
data["name"],
data["profileIconId"],
data["revisionDate"],
- data["summonerLevel"]
+ data["summonerLevel"],
)
-
reload(analyze_auto_message)
logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
PATH = os.path.dirname(os.path.realpath(__file__))
logger.info(f"PATH set to: {PATH}")
i += wait
started = tools.smart_start_stream_time.update_start_stream_timestamp()
if started == "START":
- bot.send_privmsg(message.channel, "Stream has started, you can now use ?join")
+ bot.send_privmsg(
+ message.channel, "Stream has started, you can now use ?join"
+ )
elif started == "END":
bot.send_privmsg(message.channel, "Stream has ended")
if i >= 30:
-beautifulsoup4==4.10.0
+beautifulsoup4==4.11.1
+black==22.3.0
blis==0.7.7
catalogue==2.0.7
-certifi==2021.10.8
+certifi==2022.5.18.1
charset-normalizer==2.0.12
-click==8.0.4
+click==8.1.3
cymem==2.0.6
-deep-translator==1.8.1
-en-core-web-sm @ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.2.0/en_core_web_sm-3.2.0-py3-none-any.whl
+deep-translator==1.8.3
+en-core-web-sm @ https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.3.0/en_core_web_sm-3.3.0-py3-none-any.whl
+flake8==4.0.1
+flake8-black==0.3.3
idna==3.3
-Jinja2==3.1.1
+Jinja2==3.1.2
langcodes==3.3.0
MarkupSafe==2.1.1
-murmurhash==1.0.6
-numpy==1.22.3
+mccabe==0.6.1
+murmurhash==1.0.7
+mypy-extensions==0.4.3
+numpy==1.22.4
packaging==21.3
+pathspec==0.9.0
pathy==0.6.1
+platformdirs==2.5.2
preshed==3.0.6
+pycodestyle==2.8.0
pydantic==1.8.2
-pyparsing==3.0.7
+pyflakes==2.4.0
+pyparsing==3.0.9
python-dotenv==0.20.0
requests==2.27.1
smart-open==5.2.1
-soupsieve==2.3.1
-spacy==3.2.4
+soupsieve==2.3.2.post1
+spacy==3.3.0
spacy-legacy==3.0.9
spacy-loggers==1.0.2
-srsly==2.4.2
-thinc==8.0.15
-tqdm==4.63.1
-typer==0.4.0
-typing-extensions==4.1.1
+srsly==2.4.3
+thinc==8.0.16
+tomli==2.0.1
+tqdm==4.64.0
+typer==0.4.1
+typing-extensions==4.2.0
urllib3==1.26.9
wasabi==0.9.1
+websocket-client==1.3.2
import tools.smart_privmsg
import random
+
def alwase(bot: Bot, message: Message):
if "always" not in message.value.lower():
return
replied_msg_id = message.tags["id"]
except KeyError:
replied_msg_id = None
- msgs = ["It's alwase Madge", "Why don't you spell it alwase? Madge", "Spell it alwase or peepoArriveBan"]
+ msgs = [
+ "It's alwase Madge",
+ "Why don't you spell it alwase? Madge",
+ "Spell it alwase or peepoArriveBan",
+ ]
msg = random.choice(msgs)
tools.smart_privmsg.send(bot, message, msg, reply=replied_msg_id)
return
msg = ""
if "reply-parent-msg-body" in message.tags:
- if message.value.split(' ')[1] == "Chatting":
- msg = ' '.join(message.value.split(' ')[1:])
+ if message.value.split(" ")[1] == "Chatting":
+ msg = " ".join(message.value.split(" ")[1:])
else:
- if message.value.split(' ')[0] == "Chatting":
+ if message.value.split(" ")[0] == "Chatting":
msg = message.value
if msg:
tools.smart_privmsg.send(bot, message, msg)
streamer_login = os.path.split(STREAMER_PATH)[1]
logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
def clean_queue():
found_single = False
for w in doc:
# print(w.text, w.pos_)
- if w.pos_ in {'AUX', 'VERB', 'ADP'}:
+ if w.pos_ in {"AUX", "VERB", "ADP"}:
if feet_was_last and not next_should_be_double:
ft_inch.append((feet, 0.0))
feet = 0
inches = 0
- if w.like_num or w.pos_ == 'NUM':
+ if w.like_num or w.pos_ == "NUM":
# index_of_previous_token = w.i - 1
# try:
# prev_token = doc[index_of_previous_token]
ft_inch.append((feet, 0.0))
feet = float(w.text)
feet_was_last = True
- elif next_token.lemma_ in {"inch", "\""}:
- if next_token.lemma_ == "\"" and next_should_be_double:
+ elif next_token.lemma_ in {"inch", '"'}:
+ if next_token.lemma_ == '"' and next_should_be_double:
inches = float(w.text)
next_should_be_double = False
- elif next_token.lemma_ == "\"":
+ elif next_token.lemma_ == '"':
inches = 0
elif next_should_be_double:
feet = 0
from typing import Optional
logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-formatter = logging.Formatter("[%(levelname)s] %(asctime)s: %(name)s; %(message)s")
-
-file_handler = logging.FileHandler("/var/log/aptbot/logs.log")
-file_handler.setFormatter(formatter)
-
-logger.handlers = []
-logger.addHandler(file_handler)
STREAMER_PATH = os.path.abspath(os.path.join(__file__, "../.."))
logger.debug(f"STREAMER_PATH set to: {STREAMER_PATH}")
if time.time() < last_checked + CHECK_STREAMTIME_CD:
logger.info(f"returned cached start stream time: {start_stream_ts}")
conn.close()
- return
+ return
stream_info = ttv_api.stream.get_streams(user_logins=[streamer_login])
logger.info(f"used twitch api to get stream info")
)
conn.close()
logger.info(f"returned cached start stream time: {start_stream_ts}")
- return
+ return
AND list_values.id = ?
AND methods.name = ?
""",
- (
- self.name,
- self.list_id,
- self.method
- )
+ (self.name, self.list_id, self.method),
)
conn.close()
pass
def get_newest_video(channel_id: str) -> Optional[Video]:
get_video_snippets = "?part=snippet"
- get_url = URL + get_video_snippets + \
- f"&channelId={channel_id}&order=date&type=video" + f"&key={API}"
+ get_url = (
+ URL
+ + get_video_snippets
+ + f"&channelId={channel_id}&order=date&type=video"
+ + f"&key={API}"
+ )
http = urllib3.PoolManager()
r = http.request(