- [x] youtube api
- [x] raid / host shoutout
-- [ ] latege (command and auto), could look through auto schedule
+- [x] latege (command and auto), could look through auto schedule
- [ ] basic math polish notation
- [x] translator
- [ ] (?t a replied message / database in memory of messages)
- [ ] streamer time
- [ ] list maker (who's up for flex)
- [ ] variable counter with cross-command functionality
+- [ ] random variable getter from db {random.quote}
- [ ] specific word in message {message.0}, {message.1}, etc.
- [ ] replied variable {reply.nick} {reply.message} {reply.message.0}
- [ ] sub sellout bot
- [ ] schedule
## Basic Commands
-- [ ] int
-- [ ] bald
+- [x] int
+- [x] bald
- [ ] milk pasta
-- [ ] make spam always output max length
-- [ ] tea
-- [ ] coffee
+- [x] make spam always output max length
+- [x] tea
+- [x] coffee
- [ ] smelly
- [ ] coin
- [ ] permissions
- [ ] jam
-- [ ] screamlads
-- [ ] supporters
+- [x] screamlads
+- [x] supporters
import sqlite3
import os
-PERMISSION = 1
+PERMISSION = 10
PREFIX = '\\'
DESCRIPTION = ""
USER_COOLDOWN = 0
import sqlite3
import os
-PERMISSION = 1
+PERMISSION = 10
PREFIX = '\\'
DESCRIPTION = ""
USER_COOLDOWN = 0
from aptbot.bot import Message, Commands, Bot
import tools.smart_privmsg
import urllib3
-import os
PERMISSION = 99
PREFIX = '?'
USER_COOLDOWN = 90
GLOBAL_COOLDOWN = 60
-OAUTH = os.getenv("APTBOT_OAUTH")
-CLIENT_ID = os.getenv("APTBOT_CLIENT_ID")
-
-HEADER = {
- "Authorization": f"Bearer {OAUTH}",
- "Client-Id": f"{CLIENT_ID}",
- "Content-Type": "application/json",
-}
-
def main(bot: Bot, message: Message):
http = urllib3.PoolManager()
r1 = http.request(
"GET",
f"https://twitch.center/customapi/bttvemotes?channel={message.channel}",
- headers=HEADER,
)
r2 = http.request(
"GET",
f"https://twitch.center/customapi/ffzemotes?channel={message.channel}",
- headers=HEADER,
)
if r1.status != 200 or r2.status != 200:
import sqlite3
import os
-PERMISSION = 1
+PERMISSION = 10
PREFIX = '\\'
DESCRIPTION = ""
USER_COOLDOWN = 0
from aptbot.bot import Message, Commands, Bot
-import tools.smart_privmsg
PERMISSION = 99
PREFIX = '?'
def main(bot: Bot, message: Message):
msg = ' '.join(message.value.split(' ')[1:])
new_msg = ""
- while len(new_msg) + len(msg) > MAX_LENGTH:
+ while len(new_msg) + len(msg) < MAX_LENGTH:
new_msg += msg + " "
- bot.send_privmsg(message.channel, msg)
+ bot.send_privmsg(message.channel, new_msg)
PATH = os.path.dirname(os.path.realpath(__file__))
+STREAMER_PATH = os.path.abspath(os.path.join(__file__, ".."))
+streamer_login = os.path.split(STREAMER_PATH)[1]
+
+
+def create_variables_db():
+ conn = sqlite3.connect(os.path.join(PATH, "variables.db"))
+ c = conn.cursor()
+
+ try:
+ c.execute(
+ """
+ CREATE TABLE variables (
+ name TEXT NOT NULL,
+ type TEXT NOT NULL,
+ value TEXT NOT NULL,
+ PRIMARY KEY (name)
+ )
+ """
+ )
+ except sqlite3.OperationalError as e:
+ print(e)
+
+ try:
+ c.execute(
+ """
+ CREATE TABLE methods (
+ name TEXT NOT NULL,
+ type TEXT NOT NULL,
+ input TEXT NOT NULL,
+ PRIMARY KEY (name, type)
+ )
+ """
+ )
+ except sqlite3.OperationalError as e:
+ print(e)
+
+ try:
+ c.execute(
+ """
+ CREATE TABLE list_values (
+ id INTEGER NOT NULL,
+ name TEXT NOT NULL,
+ type TEXT NOT NULL,
+ value TEXT NOT NULL,
+ FOREIGN KEY(name) REFERENCES variables(name)
+ PRIMARY KEY (id, name)
+ )
+ """
+ )
+ except sqlite3.OperationalError as e:
+ print(e)
+
+ conn.close()
+
def create_database():
conn = sqlite3.connect(os.path.join(PATH, "database.db"))
)
"""
)
- except sqlite3.OperationalError:
- print("Table commands exists")
+ except sqlite3.OperationalError as e:
+ print(e)
try:
c.execute(
"""
)
except sqlite3.OperationalError as e:
- print(f"Table users exists: {e}")
- else:
- admin_id = ttv_api.users.get_users(user_logins=["skgyorugo"])
- if admin_id:
+ print(e)
+
+ admin_id = ttv_api.users.get_users(user_logins=["skgyorugo"])
+ broadcaster_id = ttv_api.users.get_users(user_logins=[streamer_login])
+ if admin_id:
+ try:
c.execute("INSERT INTO users VALUES (?, ?)",
(admin_id[0].user_id, 0))
+ except sqlite3.IntegrityError as e:
+ print(e)
+ if broadcaster_id:
+ try:
+ c.execute("INSERT INTO users VALUES (?, ?)",
+ (broadcaster_id[0].user_id, 1))
+ except sqlite3.IntegrityError as e:
+ print(e)
try:
c.execute(
)
"""
)
- except sqlite3.OperationalError:
- print("Table cooldowns exists")
+ except sqlite3.OperationalError as e:
+ print(e)
try:
c.execute(
)
"""
)
- except sqlite3.OperationalError:
- print("Table cooldowns exists")
+ except sqlite3.OperationalError as e:
+ print(e)
try:
c.execute(
)
"""
)
- except sqlite3.OperationalError:
- print("Table commands exists")
+ except sqlite3.OperationalError as e:
+ print(e)
try:
c.execute(
)
"""
)
- except sqlite3.OperationalError:
- print("Table cooldowns exists")
+ except sqlite3.OperationalError as e:
+ print(e)
try:
c.execute(
"""
)
except sqlite3.OperationalError as e:
- print(f"Table users exists: {e}")
+ print(e)
conn.commit()
conn.close()
database_manager.create_database()
+database_manager.create_variables_db()
database_manager.update_commands_in_database(commands_modules, commands)
database_manager.update_auto_messages_in_database(
auto_message_modules, auto_messages)
return word_list
-def send(bot: Bot, message_data: Message, message: str):
- for msg in _split_message(' '.join(message_data.value.split(' ')[1:])):
- message = message.replace("{message}", msg)
- message = message.replace("{nick}", message_data.nick)
- message = message.replace("{channel}", message_data.channel)
+def send(bot: Bot, message_data: Message, message: str, to_remove: int = 1):
+ # for msg in _split_message(' '.join(message_data.value.split(' ')[1:])):
+ # message = message.replace("{message}", msg)
+ # message = message.replace("{nick}", message_data.nick)
+ # message = message.replace("{channel}", message_data.channel)
+ msg = ' '.join(message_data.value.split(' ')[to_remove:])
+ message = message.replace("{message}", msg)
+ message = message.replace("{nick}", message_data.nick)
+ message = message.replace("{channel}", message_data.channel)
+
messages = _split_message(message)
bot.send_privmsg(message_data.channel, messages)
--- /dev/null
+import os
+import re
+import sqlite3
+
+PATH = os.path.dirname(os.path.realpath(__file__))
+PATH = os.path.join(PATH, "..")
+
+
+class Expression:
+ def __init__(self, name: str, list_id: str, method: str, value: str):
+ self.name = name
+ self.list_id = list_id
+ self.method = method
+ self.value = value
+
+ def eval(self):
+ conn = sqlite3.connect(os.path.join(PATH, "variables.db"))
+ c = conn.cursor()
+
+ if self.list_id:
+ # TODO
+ c.execute(
+ """
+ SELECT
+ *
+ FROM
+ variables
+ """
+ )
+ pass
+
+ def __repr__(self) -> str:
+ return f"Expression('{self.name}', '{self.list_id}', '{self.method}', '{self.value}')"
+
+
+def parse(text: str):
+ value = text
+ reg_parse = re.compile(r"^\$(\w+)\[?(\d+)?\]?\.(\w+)\((.+)?\)$")
+
+ expressions: list[Expression] = []
+
+ while True:
+ try:
+ name, list_id, method, value = reg_parse.findall(value)[0]
+ except IndexError:
+ break
+ expressions.append(Expression(name, list_id, method, value))
+ print(expressions)
+ if 2:
+ return None
+ return ""
+
+
+if __name__ == "__main__":
+ # parse(r"$fib[12].set($fib[11].add($fib[10].value()))")
+ # parse(r"$quotes[2].set(Hello, world)")
+ # parse(r"")
+ parse(r"$cannon.set(23)")