fixed a bug in the discord account getter
fixed !lastseen on discord, aswell as multi-page responses
This commit is contained in:
+1
-1
@@ -48,7 +48,7 @@ class IgnCore:
|
||||
self.last_timer_event = 0
|
||||
self.start_time = int(time.time())
|
||||
self.major_version = "IGNCore v2.9"
|
||||
self.minor_version = "3"
|
||||
self.minor_version = "4"
|
||||
self.incoming_queue = FifoQueue()
|
||||
self.mass_message_queue = None
|
||||
self.conns = DictObject()
|
||||
|
||||
@@ -92,10 +92,10 @@ class DiscordCommandHandler(BaseModule):
|
||||
body = self.discord.text.split_by_separators(embeds.description, 4000, 10)
|
||||
tmp1 = embeds
|
||||
embeds = []
|
||||
for x in enumerate(body):
|
||||
for x, e in enumerate(body):
|
||||
tmp = tmp1.copy()
|
||||
tmp.description = body[x]
|
||||
tmp.title += f"*Page ({x}/{len(body)}*"
|
||||
tmp.description = e
|
||||
tmp.title += f"*Page ({x}/{len(body)})*"
|
||||
embeds.append(tmp)
|
||||
else:
|
||||
embeds = [embeds]
|
||||
|
||||
@@ -186,8 +186,9 @@ class DiscordController:
|
||||
elif type(msg) == ChatBlob:
|
||||
if msg.embed:
|
||||
msg: ChatBlob
|
||||
des = self.cmd.parseDiscord(msg.msg, blob=True)
|
||||
blob = Embed(title=self.cmd.parseDiscord(f"{msg.page_prefix} {msg.title} {msg.page_postfix}"),
|
||||
color=0x00FF00, description=self.cmd.parseDiscord(msg.msg, blob=True).replace("\n> ", '\n'))
|
||||
color=0x00FF00, description=(des or "").replace("\n> ", '\n'))
|
||||
asyncio.run_coroutine_threadsafe(ch.send("", delete_after=del_after, embed=blob), self.loop)
|
||||
return
|
||||
rsp = self.cmd.parseDiscord(ctx.formatted_message.page_prefix) + "\n"
|
||||
|
||||
@@ -18,8 +18,7 @@ class DiscordData:
|
||||
return self.db.exec("UPDATE account SET discord_handle = ? WHERE discord_id = ?", [handle, discord_id])
|
||||
|
||||
def get_discord_invite(self, invite):
|
||||
return self.db.query_single("SELECT * FROM account WHERE discord_invite = ?", [invite])
|
||||
return self.db.query_single("SELECT * FROM account WHERE discord_invite = ? and a.main=a.char_id", [invite])
|
||||
|
||||
def get_account_discord_id(self, discord_id):
|
||||
return self.db.query_single(
|
||||
"SELECT * FROM account a left join player p on a.char_id=p.char_id WHERE discord_id = ?", [discord_id])
|
||||
return self.db.query_single("SELECT * FROM account a left join player p on a.char_id=p.char_id WHERE a.discord_id = ? and a.main=a.char_id", [discord_id])
|
||||
@@ -6,7 +6,6 @@ and is being maintained by a group <highlight>Volunteers</highlight>.
|
||||
At this point, we'd like to send a special "thank you" to the following people, which in one way or another, contributed to IGNCore/IGNCom:
|
||||
» <highlight>Zetabyte & its Network</highlight>, for many feature ideas,
|
||||
and the heavy assistance with knowledge.
|
||||
» <highlight>Chrisax</highlight> for hosting the !history mirror.
|
||||
» Everyone who participated in test runs,
|
||||
» sent us ideas for bot improvements,
|
||||
» helped us by sending bug reports our way,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import time
|
||||
|
||||
from core.buddy_service import BuddyService
|
||||
from core.chat_blob import ChatBlob
|
||||
from core.command_param_types import Character, Int
|
||||
from core.decorators import event, instance, command
|
||||
from core.logger import Logger
|
||||
@@ -57,8 +58,7 @@ class NotifyController:
|
||||
for log in logs:
|
||||
blob += f"<grey>[{self.util.format_datetime(log.time)}]</grey> <highlight>{log.name}</highlight> -> " \
|
||||
f"{'<green>logged on</green>' if log.status == 1 else '<red>logged off</red>'}.\n"
|
||||
return f"<highlight>{char.name}</highlight> was last seen at " \
|
||||
f"{self.util.format_date(logs[0].time)}. {self.text.format_page('More', blob)}"
|
||||
return ChatBlob("More", blob, prefix=f"<highlight>{char.name}</highlight> was last seen at {self.util.format_date(logs[0].time)}. [", suffix="]")
|
||||
|
||||
def get_log(self, char_list, length=16):
|
||||
query = "SELECT n.*, p.name as name FROM notify_log n LEFT JOIN player p on n.char_id = p.char_id "
|
||||
|
||||
@@ -5,7 +5,7 @@ from datetime import datetime
|
||||
import pytz
|
||||
|
||||
from core.chat_blob import ChatBlob
|
||||
from core.command_param_types import Any, Const
|
||||
from core.command_param_types import Any, Const, Int
|
||||
from core.decorators import instance, command
|
||||
|
||||
|
||||
@@ -50,6 +50,12 @@ class TimeController:
|
||||
return f"Currently its {now.hour:02}:{now.minute:02}:{now.second:02} " \
|
||||
f"{calendar.month_name[now.month]} {day}, {now.year + 27474} Rubi-Ka Universal Time."
|
||||
|
||||
@command(command="time", params=[Int("timestamp")], access_level="member",
|
||||
description="Show UTC time of the provided timestamp")
|
||||
def timestamp_cmd(self, _, t: int):
|
||||
d = datetime.fromtimestamp(t, pytz.utc)
|
||||
return f"Your provided timestamp resolves to: <highlight>{d.strftime(self.time_format)}</highlight>"
|
||||
|
||||
@command(command="time", params=[Any("timezone")], access_level="member",
|
||||
description="Show time for the specified timezone")
|
||||
def time_zone_cmd(self, _, timezone_str):
|
||||
|
||||
Reference in New Issue
Block a user