--- /dev/null
+[flake8]
+ignore = E203, W503
+max-line-length = 88
data = json.loads(r.data.decode("utf-8"))
joke = data["joke"].replace("\r\n", " ")
- tools.smart_privmsg.send(
- bot, message, f"{joke} ||| Get more jokes by typing ?joke"
- )
+ tools.smart_privmsg.send(bot, message, f"{joke} ||| Get more jokes by typing ?joke")
def main(bot: Bot, message: Message):
- msg = "I collect data and occasionally post interesting statistics on peks' discord. "
+ msg = (
+ "I collect data and occasionally post interesting statistics on peks' discord. "
+ )
msg += "The type of data you should expect to see is 'Chat frequency', 'Most used emotes', "
msg += "'Most active time and day', 'Reply graphs', etc. "
bot.send_privmsg(message.channel, msg)
)
c.execute(f"DELETE FROM {table} WHERE time_remaining < 0;")
if c.rowcount:
- bot.send_privmsg(message.channel, f"/announce {c.rowcount} user{'s were' if c.rowcount > 1 else ' was'} just removed from {table if table != 'lol_queue' else 'lol'} queue.")
+ bot.send_privmsg(
+ message.channel,
+ f"/announce {c.rowcount} user{'s were' if c.rowcount > 1 else ' was'} just removed from {table if table != 'lol_queue' else 'lol'} queue.",
+ )
conn.commit()
else:
msg = r"Peks is live so he can awnser that KEKW but here is the link just in case BASED https://strms.net/warships_ihaspeks"
tools.smart_privmsg.send_safe(bot, message.channel, msg)
-
openai.api_key = os.getenv("OPENAI_API")
+
def main(bot: Bot, message: Message):
replied_message = message.tags.get("reply-parent-msg-body", None)
if replied_message:
replied_msg_id = message.tags["reply-parent-msg-id"]
else:
msg = " ".join(message.value.split(" ")[1:])
- replied_msg_id = message.tags['id']
-
+ replied_msg_id = message.tags["id"]
try:
response = openai.Completion.create(
stop=[" END"],
)
except RateLimitError:
- tools.smart_privmsg.send_safe(bot, message.channel, "UwU Sowwy. The sevwews awe ovewloaded :( Twy again in a few minutes OwO", reply=replied_msg_id)
+ tools.smart_privmsg.send_safe(
+ bot,
+ message.channel,
+ "UwU Sowwy. The sevwews awe ovewloaded :( Twy again in a few minutes OwO",
+ reply=replied_msg_id,
+ )
print(response)
if response:
PATH = os.path.dirname(os.path.realpath(__file__))
PATH = os.path.join(PATH, "..")
+
def check_queue(bot: Bot, message: Message, table: str):
if random.random() < 0.02:
q = [
d = dict()
for i in shlex.split(query):
try:
- d[i.split('=')[0]] = i.split('=')[1]
+ d[i.split("=")[0]] = i.split("=")[1]
except:
pass
return d
def scrub(table_name):
- return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_')
+ return "".join(chr for chr in table_name if chr.isalnum() or chr == "_")
def main(bot: Bot, message: Message):
with open(accepted_path, "a") as f:
f.write(f"{message.tags['user-id']}\n")
tools.smart_privmsg.send(bot, message, "Thank you for giving permission")
-
PATH = os.path.dirname(os.path.realpath(__file__))
PATH = os.path.join(PATH, "..")
+
def check_queue(bot: Bot, message: Message, table: str):
conn = sqlite3.connect(os.path.join(PATH, "database.db"))
c = conn.cursor()
f"""
UPDATE varvalues SET val = ? WHERE id = 'cannon';
""",
- (val,)
+ (val,),
)
msg = f"Peks is at cannon {val % 1000} of prestige {val // 1000}"
f"""
UPDATE varvalues SET val = ? WHERE id = 'cannon';
""",
- (val,)
+ (val,),
)
msg = f"Peks is at cannon {val % 1000} of prestige {val // 1000}"
d = dict()
for i in shlex.split(query):
try:
- d[i.split('=')[0]] = i.split('=')[1]
+ d[i.split("=")[0]] = i.split("=")[1]
except:
pass
return d
def scrub(table_name):
- return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_')
+ return "".join(chr for chr in table_name if chr.isalnum() or chr == "_")
def main(bot: Bot, message: Message):
d = dict()
for i in shlex.split(query):
try:
- d[i.split('=')[0]] = i.split('=')[1]
+ d[i.split("=")[0]] = i.split("=")[1]
except:
pass
return d
def scrub(table_name):
- return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_')
+ return "".join(chr for chr in table_name if chr.isalnum() or chr == "_")
def main(bot: Bot, message: Message):
PATH = os.path.dirname(os.path.realpath(__file__))
PATH = os.path.join(PATH, "..")
+
def check_queue(bot: Bot, message: Message, table: str):
conn = sqlite3.connect(os.path.join(PATH, "database.db"))
c = conn.cursor()
f"""
UPDATE varvalues SET val = ? WHERE id = 'deadge_sekiro';
""",
- (val,)
+ (val,),
)
msg = f"Peks has currently died {val} times"
f"""
UPDATE varvalues SET val = ? WHERE id = 'deadge_sekiro';
""",
- (val,)
+ (val,),
)
msg = f"Peks has currently died {val} times"
d = dict()
for i in shlex.split(query):
try:
- d[i.split('=')[0]] = i.split('=')[1]
+ d[i.split("=")[0]] = i.split("=")[1]
except:
pass
return d
def scrub(table_name):
- return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_')
+ return "".join(chr for chr in table_name if chr.isalnum() or chr == "_")
def main(bot: Bot, message: Message):
d = dict()
for i in shlex.split(query):
try:
- d[i.split('=')[0]] = i.split('=')[1]
+ d[i.split("=")[0]] = i.split("=")[1]
except:
pass
return d
def scrub(table_name):
- return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_')
+ return "".join(chr for chr in table_name if chr.isalnum() or chr == "_")
def main(bot: Bot, message: Message):
d = dict()
for i in shlex.split(query):
try:
- d[i.split('=')[0]] = i.split('=')[1]
+ d[i.split("=")[0]] = i.split("=")[1]
except:
pass
return d
def scrub(table_name):
- return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_')
+ return "".join(chr for chr in table_name if chr.isalnum() or chr == "_")
def main(bot: Bot, message: Message):
d = dict()
for i in shlex.split(query):
try:
- d[i.split('=')[0]] = i.split('=')[1]
+ d[i.split("=")[0]] = i.split("=")[1]
except:
pass
return d
def scrub(table_name):
- return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_')
+ return "".join(chr for chr in table_name if chr.isalnum() or chr == "_")
def main(bot: Bot, message: Message):
d = dict()
for i in shlex.split(query):
try:
- d[i.split('=')[0]] = i.split('=')[1]
+ d[i.split("=")[0]] = i.split("=")[1]
except:
pass
return d
def scrub(table_name):
- return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_')
+ return "".join(chr for chr in table_name if chr.isalnum() or chr == "_")
def main(bot: Bot, message: Message):
d = dict()
for i in shlex.split(query):
try:
- d[i.split('=')[0]] = i.split('=')[1]
+ d[i.split("=")[0]] = i.split("=")[1]
except:
pass
return d
def scrub(table_name):
- return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_')
+ return "".join(chr for chr in table_name if chr.isalnum() or chr == "_")
def main(bot: Bot, message: Message):
d = dict()
for i in shlex.split(query):
try:
- d[i.split('=')[0]] = i.split('=')[1]
+ d[i.split("=")[0]] = i.split("=")[1]
except:
pass
return d
def scrub(table_name):
- return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_')
+ return "".join(chr for chr in table_name if chr.isalnum() or chr == "_")
def main(bot: Bot, message: Message):
d = dict()
for i in shlex.split(query):
try:
- d[i.split('=')[0]] = i.split('=')[1]
+ d[i.split("=")[0]] = i.split("=")[1]
except:
pass
return d
def scrub(table_name):
- return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_')
+ return "".join(chr for chr in table_name if chr.isalnum() or chr == "_")
def main(bot: Bot, message: Message):
d = dict()
for i in shlex.split(query):
try:
- d[i.split('=')[0]] = i.split('=')[1]
+ d[i.split("=")[0]] = i.split("=")[1]
except:
pass
return d
def scrub(table_name):
- return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_')
+ return "".join(chr for chr in table_name if chr.isalnum() or chr == "_")
def main(bot: Bot, message: Message):
d = dict()
for i in shlex.split(query):
try:
- d[i.split('=')[0]] = i.split('=')[1]
+ d[i.split("=")[0]] = i.split("=")[1]
except:
pass
return d
def scrub(table_name):
- return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_')
+ return "".join(chr for chr in table_name if chr.isalnum() or chr == "_")
def main(bot: Bot, message: Message):
d = dict()
for i in shlex.split(query):
try:
- d[i.split('=')[0]] = i.split('=')[1]
+ d[i.split("=")[0]] = i.split("=")[1]
except:
pass
return d
def scrub(table_name):
- return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_')
+ return "".join(chr for chr in table_name if chr.isalnum() or chr == "_")
def main(bot: Bot, message: Message):
d = dict()
for i in shlex.split(query):
try:
- d[i.split('=')[0]] = i.split('=')[1]
+ d[i.split("=")[0]] = i.split("=")[1]
except:
pass
return d
def scrub(table_name):
- return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_')
+ return "".join(chr for chr in table_name if chr.isalnum() or chr == "_")
def main(bot: Bot, message: Message):
PATH = os.path.dirname(os.path.realpath(__file__))
PATH = os.path.join(PATH, "..")
+
def find_champion(champ_id: int) -> str:
with open(os.path.join(PATH, "data/champion.json"), "r") as f:
champion_data = json.load(f)
return champion_data[champion]["name"]
return "404"
+
def main(bot: Bot, message: Message):
index_skip = 0
if message.tags.get("reply-parent-user-id", None):
except IndexError:
twitch_user = message.tags.get("reply-parent-display-name", message.channel)
twitch_id = message.tags.get(
- "reply-parent-user-id",
- ttv_api.users.get_users(user_logins=[message.channel]),
- )
+ "reply-parent-user-id",
+ ttv_api.users.get_users(user_logins=[message.channel]),
+ )
else:
twitch_id = ttv_api.users.get_users(user_logins=[twitch_user])
if not twitch_id:
logger.warning(
- f"There was an issue getting twitch data for user {twitch_id}; message id was: {message.tags['id']}"
- )
+ f"There was an issue getting twitch data for user {twitch_id}; message id was: {message.tags['id']}"
+ )
smart_privmsg.send(
- bot, message, "Couldn't retrieve data", reply=message.tags["id"]
- )
+ bot, message, "Couldn't retrieve data", reply=message.tags["id"]
+ )
return
if not isinstance(twitch_id, str):
c = conn.cursor()
c.execute(
- """
+ """
SELECT summoner_id, puuid FROM accounts WHERE twitch_id = ?;
""",
(twitch_id,),
- )
+ )
fetched = c.fetchall()
c.execute(
- """
+ """
SELECT twitch_id, summoner_id FROM accounts;
""",
- )
+ )
fetched_all = c.fetchall()
if not fetched:
smart_privmsg.send(
- bot,
- message,
- f"No summoners added for {twitch_user}",
- reply=message.tags["id"],
- )
+ bot,
+ message,
+ f"No summoners added for {twitch_user}",
+ reply=message.tags["id"],
+ )
conn.close()
return
break
else:
smart_privmsg.send(
- bot,
- message,
- f"{twitch_user} is currently not in game. These are all of their summoners: {summoner_names}",
- reply=message.tags["id"],
- )
+ bot,
+ message,
+ f"{twitch_user} is currently not in game. These are all of their summoners: {summoner_names}",
+ reply=message.tags["id"],
+ )
conn.close()
return
if summoner.summoner_id == f[1] and summoner.summoner_id != fetched[0][0]:
play_with.append(
{
- "name": ttv_api.users.get_users(user_ids=[f[0]])[0].display_name,
+ "name": ttv_api.users.get_users(user_ids=[f[0]])[
+ 0
+ ].display_name,
"champion": find_champion(summoner.champion_id),
},
)
for player in play_with:
msg += f" {player['name']} on {player['champion']} |"
msg = msg[:-1] + "."
-
+
smart_privmsg.send(
- bot,
- message,
- msg,
- reply=message.tags["id"],
- )
+ bot,
+ message,
+ msg,
+ reply=message.tags["id"],
+ )
conn.close()
PATH = os.path.dirname(os.path.realpath(__file__))
PATH = os.path.join(PATH, "..")
+
def check_queue(bot: Bot, message: Message, table: str):
conn = sqlite3.connect(os.path.join(PATH, "database.db"))
c = conn.cursor()
f"""
UPDATE varvalues SET val = ? WHERE id = 'cannon';
""",
- (val,)
+ (val,),
)
msg = f"Peks has gotten {val} pentas!"
f"""
UPDATE varvalues SET val = ? WHERE id = 'cannon';
""",
- (val,)
+ (val,),
)
msg = f"Peks has gotten {val} pentas!"
d = dict()
for i in shlex.split(query):
try:
- d[i.split('=')[0]] = i.split('=')[1]
+ d[i.split("=")[0]] = i.split("=")[1]
except:
pass
return d
def scrub(table_name):
- return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_')
+ return "".join(chr for chr in table_name if chr.isalnum() or chr == "_")
def main(bot: Bot, message: Message):
PATH = os.path.dirname(os.path.realpath(__file__))
PATH = os.path.join(PATH, "..")
+
def check_queue(bot: Bot, message: Message, table: str):
conn = sqlite3.connect(os.path.join(PATH, "database.db"))
c = conn.cursor()
f"""
UPDATE varvalues SET val = ? WHERE id = 'cannon';
""",
- (val,)
+ (val,),
)
msg = f"Peks has missed out on {val} pentas!"
f"""
UPDATE varvalues SET val = ? WHERE id = 'cannon';
""",
- (val,)
+ (val,),
)
msg = f"Peks has missed out on {val} pentas!"
d = dict()
for i in shlex.split(query):
try:
- d[i.split('=')[0]] = i.split('=')[1]
+ d[i.split("=")[0]] = i.split("=")[1]
except:
pass
return d
def scrub(table_name):
- return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_')
+ return "".join(chr for chr in table_name if chr.isalnum() or chr == "_")
def main(bot: Bot, message: Message):
d = dict()
for i in shlex.split(query):
try:
- d[i.split('=')[0]] = i.split('=')[1]
+ d[i.split("=")[0]] = i.split("=")[1]
except:
pass
return d
def scrub(table_name):
- return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_')
+ return "".join(chr for chr in table_name if chr.isalnum() or chr == "_")
def main(bot: Bot, message: Message):
d = dict()
for i in shlex.split(query):
try:
- d[i.split('=')[0]] = i.split('=')[1]
+ d[i.split("=")[0]] = i.split("=")[1]
except:
pass
return d
def scrub(table_name):
- return ''.join(chr for chr in table_name if chr.isalnum() or chr == '_')
+ return "".join(chr for chr in table_name if chr.isalnum() or chr == "_")
def main(bot: Bot, message: Message):
)
logger.info(f"created table varvalues")
-
c.execute(
"""
CREATE TABLE IF NOT EXISTS clips (
openai.api_key = os.getenv("OPENAI_API")
+
def chat(bot: Bot, message: Message):
- if not message.nick in {'skgyorugo', 'ihaspeks'}:
+ if not message.nick in {"skgyorugo", "ihaspeks"}:
return
if not message.value.startswith("# "):
return
replied_msg_id = message.tags["reply-parent-msg-id"]
else:
msg = " ".join(message.value.split(" ")[1:])
- replied_msg_id = message.tags['id']
+ replied_msg_id = message.tags["id"]
response = openai.Completion.create(
model="text-davinci-003",
allow_headers=["*"],
)
+
@app.get("/clip")
async def root():
clips = [
]
return random.choice(clips)
+
# logger = logging.getLogger(__name__)
# PATH = os.path.dirname(os.path.realpath(__file__))
replied_msg_id = message.tags["id"]
except KeyError:
replied_msg_id = None
- msg = "Oh 😂 look 😂 at 😂 me 😂 I 😂 use 😂 this 😂 funny 😂 emoji 😂 hahahaha 😂😂😂😂😂 lit 💯 👌"
+ msg = (
+ "Oh 😂 look 😂 at 😂 me 😂 I 😂 use 😂 this 😂 funny 😂 emoji 😂 hahahaha 😂😂😂😂😂 lit 💯 👌"
+ )
tools.smart_privmsg.send(bot, message, msg, reply=replied_msg_id)