Merge remote-tracking branch 'origin/master'
All checks were successful
Build and Publish Jimmy.2 / build_and_publish (push) Successful in 7s
All checks were successful
Build and Publish Jimmy.2 / build_and_publish (push) Successful in 7s
This commit is contained in:
commit
6b7968eef1
2 changed files with 41 additions and 2 deletions
|
@ -1,4 +1,5 @@
|
||||||
import logging
|
import logging
|
||||||
|
import textwrap
|
||||||
|
|
||||||
import discord
|
import discord
|
||||||
import json
|
import json
|
||||||
|
@ -62,6 +63,44 @@ class Starboard(commands.Cog):
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
if message.reference:
|
||||||
|
try:
|
||||||
|
ref_message = await self.get_or_fetch_message(message.reference.channel_id, message.reference.message_id)
|
||||||
|
except discord.HTTPException:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
text = ref_message.content.splitlines()[0]
|
||||||
|
v = f"[{ref_message.author.mention}'s message: ]({ref_message.jump_url})"
|
||||||
|
remaining = 1024 - len(v)
|
||||||
|
t = textwrap.shorten(text, remaining, placeholder="...")
|
||||||
|
v = f"[{ref_message.author.display_name}'s message: {t}]({ref_message.jump_url})"
|
||||||
|
embed.add_field(
|
||||||
|
name="Replying to",
|
||||||
|
value=v
|
||||||
|
)
|
||||||
|
elif message.interaction:
|
||||||
|
if message.interaction.type == discord.InteractionType.application_command:
|
||||||
|
real_author: discord.User = await discord.utils.get_or_fetch(
|
||||||
|
self.bot,
|
||||||
|
"user",
|
||||||
|
int(message.interaction.data["user"]["id"])
|
||||||
|
)
|
||||||
|
real_author = await discord.utils.get_or_fetch(
|
||||||
|
message.guild,
|
||||||
|
"member",
|
||||||
|
real_author.id,
|
||||||
|
default=real_author
|
||||||
|
) or message.author
|
||||||
|
embed.set_author(
|
||||||
|
name=real_author.display_name,
|
||||||
|
icon_url=real_author.display_avatar.url,
|
||||||
|
url=real_author.jump_url
|
||||||
|
)
|
||||||
|
embed.add_field(
|
||||||
|
name="Interaction",
|
||||||
|
value=f"Command `/{message.interaction.data['name']}` of {message.author.mention}"
|
||||||
|
)
|
||||||
|
|
||||||
if message.content:
|
if message.content:
|
||||||
embed.description = message.content
|
embed.description = message.content
|
||||||
elif message.embeds:
|
elif message.embeds:
|
||||||
|
|
|
@ -99,7 +99,7 @@ logging.basicConfig(
|
||||||
markup=True,
|
markup=True,
|
||||||
console=Console(width=cols, height=lns),
|
console=Console(width=cols, height=lns),
|
||||||
),
|
),
|
||||||
FileHandler(filename=CONFIG["logging"].get("file", "jimmy.log"), mode="a", encoding="utf-8", errors="replace"),
|
FileHandler(filename=CONFIG["logging"].get("file", "jimmy.log"), encoding="utf-8", errors="replace"),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
for logger in CONFIG["logging"].get("suppress", []):
|
for logger in CONFIG["logging"].get("suppress", []):
|
||||||
|
@ -116,7 +116,7 @@ class Client(commands.Bot):
|
||||||
async def start(self, token: str, *, reconnect: bool = True) -> None:
|
async def start(self, token: str, *, reconnect: bool = True) -> None:
|
||||||
if CONFIG["jimmy"].get("uptime_kuma_url"):
|
if CONFIG["jimmy"].get("uptime_kuma_url"):
|
||||||
self.uptime_thread = KumaThread(
|
self.uptime_thread = KumaThread(
|
||||||
CONFIG["jimmy"]["uptime_kuma_url"], CONFIG["jimmy"].get("uptime_kuma_interval", 60.0)
|
CONFIG["jimmy"]["uptime_kuma_url"], CONFIG["jimmy"].get("uptime_kuma_interval", 58.0)
|
||||||
)
|
)
|
||||||
self.uptime_thread.start()
|
self.uptime_thread.start()
|
||||||
await super().start(token, reconnect=reconnect)
|
await super().start(token, reconnect=reconnect)
|
||||||
|
|
Loading…
Reference in a new issue