Skip to content

Commit

Permalink
Added let func
Browse files Browse the repository at this point in the history
  • Loading branch information
LilbabxJJ-1 committed Jun 20, 2023
1 parent bdf33e4 commit d5ff376
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions CharmCord/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from .Functions import *

timezones = (timezone("EST"), timezone("UTC"), timezone("US/Pacific"))
lets = {}


class FunctionHandler:
Expand All @@ -12,7 +13,7 @@ def __init__(self):

def register_functions(self):
for line in all_Funcs:
function = eval(line.replace("$", "")) # nosec
function = eval(line.replace("$", "")) # nosec
self.funcs[line.replace("\n", "").lower()] = function

async def execute_functions(self, keyword, args, context):
Expand Down Expand Up @@ -156,7 +157,8 @@ async def findBracketPairs(entry: str, Functions, context):
end = None
balance = 0
for i in argument:
if i == "$" and start is None and argument[count + 1] != "$":
digits = ["1", "2", "3", "4", "5", "6", '7', '8', "9", "0"] # A keyword will never start or have a digit in it
if i == "$" and start is None and argument[count + 1] != "$" and argument[count + 1] not in digits: # $$keyword will discount the first $ as part of the text
start = count
elif i == "[":
balance += 1
Expand All @@ -170,9 +172,7 @@ async def findBracketPairs(entry: str, Functions, context):
argument = (
argument[:start]
+ str(
await findBracketPairs(
argument[start: end + 1], Functions, context
)
await findBracketPairs(argument[start: end + 1], Functions, context)
)
+ argument[end + 1:]
)
Expand Down

0 comments on commit d5ff376

Please sign in to comment.