mirror of
https://github.com/SpiceBot/SpiceBot.git
synced 2026-11-13 15:09:54 -05:00
test
This commit is contained in:
parent
87ca5c1398
commit
b323833c59
@ -15,6 +15,7 @@ class MessageLog():
|
|||||||
self.dict = {}
|
self.dict = {}
|
||||||
self.message_display = dict()
|
self.message_display = dict()
|
||||||
self.used_ids = [0]
|
self.used_ids = [0]
|
||||||
|
self.used_error_ids = [0]
|
||||||
self.error_message_dict = {
|
self.error_message_dict = {
|
||||||
"command_inchan_only": "$command must be run in channel.",
|
"command_inchan_only": "$command must be run in channel.",
|
||||||
"admin_switch_unauth": "The admin switch (-a) is for use by authorized nicks ONLY.",
|
"admin_switch_unauth": "The admin switch (-a) is for use by authorized nicks ONLY.",
|
||||||
@ -27,6 +28,17 @@ class MessageLog():
|
|||||||
self.used_ids.append(unique_id)
|
self.used_ids.append(unique_id)
|
||||||
return unique_id
|
return unique_id
|
||||||
|
|
||||||
|
def messagelog_error_get(self, errormsg):
|
||||||
|
for error_id in list(self.error_message_dict.keys()):
|
||||||
|
if self.error_message_dict[error_id] == errormsg:
|
||||||
|
return error_id
|
||||||
|
unique_id = 0
|
||||||
|
while unique_id in self.used_error_ids:
|
||||||
|
unique_id = uuid.uuid4()
|
||||||
|
self.used_error_ids.append(unique_id)
|
||||||
|
self.error_message_dict[unique_id] = errormsg
|
||||||
|
return unique_id
|
||||||
|
|
||||||
def messagelog_start(self, bot, trigger, log_id):
|
def messagelog_start(self, bot, trigger, log_id):
|
||||||
|
|
||||||
if not trigger.is_privmsg:
|
if not trigger.is_privmsg:
|
||||||
@ -50,6 +62,9 @@ class MessageLog():
|
|||||||
newloglist = []
|
newloglist = []
|
||||||
error_exists_prior = False
|
error_exists_prior = False
|
||||||
|
|
||||||
|
if error_id not in self.error_message_dict:
|
||||||
|
error_id = self.messagelog_error_get(error_id)
|
||||||
|
|
||||||
for existing_messagedict in self.message_display[log_id]["messages"]:
|
for existing_messagedict in self.message_display[log_id]["messages"]:
|
||||||
if existing_messagedict["type"] == "error":
|
if existing_messagedict["type"] == "error":
|
||||||
if existing_messagedict["error_id"] == error_id:
|
if existing_messagedict["error_id"] == error_id:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user