- [ ] replied variable {reply.nick} {reply.message} {reply.message.0}
- [ ] sub sellout bot
- [ ] schedule
+- [ ] which LoL account are you playing on? (maybe add rank)
## Basic Commands
- [x] int
elif latege_amount > 0:
msg = f"{message.channel} is Latege by {latege_amount} seconds again Madge"
elif latege_amount == 0:
- msg = f"Amazing!!! {message.channel} is EXACTLY on time today ihaspeHappy"
+ msg = f"Amazing!!! {message.channel} is EXACTLY on time today POGGERS"
else:
msg = f"UNBELIEVABLE!!!!! {message.channel} is EARLY by {-latege_amount} seconds!!!!\
This has NEVER happened before POGGERS"
from aptbot.bot import Message, Commands, Bot
+import tools.smart_privmsg
PERMISSION = 99
PREFIX = '?'
USER_COOLDOWN = 30
GLOBAL_COOLDOWN = 15
-MAX_LENGTH = 469
+MAX_LENGTH = 450
def main(bot: Bot, message: Message):
new_msg = ""
while len(new_msg) + len(msg) < MAX_LENGTH:
new_msg += msg + " "
- bot.send_privmsg(message.channel, new_msg)
+ tools.smart_privmsg.send_safe(bot, message.channel, new_msg)
CREATE TABLE methods (
name TEXT NOT NULL,
type TEXT NOT NULL,
- input TEXT NOT NULL,
+ input TEXT,
PRIMARY KEY (name, type)
)
"""
from aptbot.bot import Bot, Message, Commands
+from typing import Union
-MAX_LENGTH = 469
+MAX_LENGTH = 480
def _split_message(message: str) -> list[str]:
return word_list
-def send(bot: Bot, message_data: Message, message: str, to_remove: int = 1):
+def send_safe(bot: Bot, channel: str, messages: Union[str, list]):
+ if isinstance(messages, list):
+ for i in range(len(messages)):
+ if messages[i].startswith('/') or messages[i].startswith('!'):
+ messages[i] = messages[i][1:]
+ else:
+ if messages.startswith('/') or messages.startswith('!'):
+ messages = messages[1:]
+ bot.send_privmsg(channel, messages)
+
+
+def send(bot: Bot, message_data: Message, message: str, to_remove: int = 1, safe_send: bool = True):
# 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)
messages = _split_message(message)
- bot.send_privmsg(message_data.channel, messages)
+ if safe_send:
+ send_safe(bot, message_data.channel, messages)
+ else:
+ bot.send_privmsg(message_data.channel, messages)
class Expression:
- def __init__(self, name: str, list_id: str, method: str, value: str):
+ def __init__(self, name: str, list_id: int, method: str, value: str):
self.name = name
self.list_id = list_id
self.method = method
SELECT
*
FROM
- variables
- """
+ list_values
+ INNER JOIN methods USING(type)
+ WHERE
+ list_values.name = ?
+ AND list_values.id = ?
+ AND methods.name = ?
+ """,
+ (
+ self.name,
+ self.list_id,
+ self.method
+ )
)
+ conn.close()
pass
def __repr__(self) -> str:
+ print(type(self.list_id))
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+)\((.+)?\)$")
+ reg_parse = re.compile(r"\$(\w+)\[?(\d+)?\]?\.(\w+)\((.+)?\)")
expressions: list[Expression] = []
-
while True:
+
try:
name, list_id, method, value = reg_parse.findall(value)[0]
+ list_id = int(list_id)
except IndexError:
break
+ except ValueError:
+ list_id = None
expressions.append(Expression(name, list_id, method, value))
print(expressions)
if 2:
# 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)")
+ parse(r"wqe$quotes[].set($quotes[1].value(dw) + fw)")