mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-27 13:34:28 +00:00
Add full /cv
This commit is contained in:
parent
4b4a7754a1
commit
5ff11f2a98
2 changed files with 13 additions and 9 deletions
|
@ -428,6 +428,9 @@ class RoyalDiscordBot(discord.Client):
|
||||||
"!cv": self.cmd_cv,
|
"!cv": self.cmd_cv,
|
||||||
"!summon": self.cmd_cv,
|
"!summon": self.cmd_cv,
|
||||||
"!play": self.cmd_play,
|
"!play": self.cmd_play,
|
||||||
|
"!alexaplay": self.cmd_play,
|
||||||
|
"!okgoogleplay": self.cmd_play,
|
||||||
|
"!heysiriplay": self.cmd_play,
|
||||||
"!p": self.cmd_play,
|
"!p": self.cmd_play,
|
||||||
"!search": self.cmd_play,
|
"!search": self.cmd_play,
|
||||||
"!file": self.cmd_play,
|
"!file": self.cmd_play,
|
||||||
|
@ -576,7 +579,8 @@ class RoyalDiscordBot(discord.Client):
|
||||||
while True:
|
while True:
|
||||||
msg = await loop.run_in_executor(executor, connection.recv)
|
msg = await loop.run_in_executor(executor, connection.recv)
|
||||||
logger.debug(f"Received from the Telegram-Discord pipe: {msg}")
|
logger.debug(f"Received from the Telegram-Discord pipe: {msg}")
|
||||||
if msg == "get cv":
|
full_cv = (msg == "get cv full")
|
||||||
|
if msg.startswith("get cv"):
|
||||||
discord_members = list(self.main_guild.members)
|
discord_members = list(self.main_guild.members)
|
||||||
channels = {0: None}
|
channels = {0: None}
|
||||||
members_in_channels = {0: []}
|
members_in_channels = {0: []}
|
||||||
|
@ -601,7 +605,7 @@ class RoyalDiscordBot(discord.Client):
|
||||||
message += f"<b>In #{escape(channels[channel].name)}:</b>\n"
|
message += f"<b>In #{escape(channels[channel].name)}:</b>\n"
|
||||||
for member in members_in_channels[channel]:
|
for member in members_in_channels[channel]:
|
||||||
# Ignore not-connected non-notable members
|
# Ignore not-connected non-notable members
|
||||||
if channel == 0 and len(member.roles) < 2:
|
if not full_cv and channel == 0 and len(member.roles) < 2:
|
||||||
continue
|
continue
|
||||||
# Ignore offline members
|
# Ignore offline members
|
||||||
if member.status == discord.Status.offline and member.voice is None:
|
if member.status == discord.Status.offline and member.voice is None:
|
||||||
|
@ -638,13 +642,9 @@ class RoyalDiscordBot(discord.Client):
|
||||||
# Rich presence
|
# Rich presence
|
||||||
try:
|
try:
|
||||||
if member.activity.state is not None:
|
if member.activity.state is not None:
|
||||||
message += f" ({escape(member.activity.state)})"
|
message += f" ({escape(member.activity.state} | {member.activity.details)})"
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
try:
|
message += f" (⚠️)"
|
||||||
if member.activity.details is not None:
|
|
||||||
message += f" ({escape(member.activity.details)})"
|
|
||||||
except AttributeError:
|
|
||||||
pass
|
|
||||||
elif member.activity.type == discord.ActivityType.streaming:
|
elif member.activity.type == discord.ActivityType.streaming:
|
||||||
message += f" | 📡 [{escape(member.activity.name)}]({escape(member.activity.url)})"
|
message += f" | 📡 [{escape(member.activity.name)}]({escape(member.activity.url)})"
|
||||||
elif member.activity.type == discord.ActivityType.listening:
|
elif member.activity.type == discord.ActivityType.listening:
|
||||||
|
|
|
@ -107,6 +107,10 @@ def cmd_discord(bot: Bot, update: Update):
|
||||||
if discord_connection is None:
|
if discord_connection is None:
|
||||||
bot.send_message(update.message.chat.id, "⚠ Il bot non è collegato a Discord al momento.")
|
bot.send_message(update.message.chat.id, "⚠ Il bot non è collegato a Discord al momento.")
|
||||||
return
|
return
|
||||||
|
# dirty hack as usual
|
||||||
|
if update.message.text.endswith("full"):
|
||||||
|
discord_connection.send("get cv full")
|
||||||
|
else:
|
||||||
discord_connection.send("get cv")
|
discord_connection.send("get cv")
|
||||||
message = discord_connection.recv()
|
message = discord_connection.recv()
|
||||||
bot.send_message(update.message.chat.id, message, disable_web_page_preview=True, parse_mode="HTML")
|
bot.send_message(update.message.chat.id, message, disable_web_page_preview=True, parse_mode="HTML")
|
||||||
|
|
Loading…
Reference in a new issue