mirror of
https://github.com/hencaric/SCNewsBot.git
synced 2026-08-16 22:46:03 +01:00
description formatting and bot activity
This commit is contained in:
@@ -16,6 +16,9 @@ class Bot(commands.Bot):
|
|||||||
command_prefix=commands.when_mentioned_or(config.prefix),
|
command_prefix=commands.when_mentioned_or(config.prefix),
|
||||||
allowed_mentions=discord.AllowedMentions(everyone=False),
|
allowed_mentions=discord.AllowedMentions(everyone=False),
|
||||||
case_insensitive=True,
|
case_insensitive=True,
|
||||||
|
activity=discord.Activity(
|
||||||
|
type=discord.ActivityType.watching, name="the devs..."
|
||||||
|
),
|
||||||
)
|
)
|
||||||
self.config = config
|
self.config = config
|
||||||
self.version = VERSION
|
self.version = VERSION
|
||||||
|
|||||||
@@ -16,6 +16,16 @@ async def get_ping_message(message: discord.Message, /) -> Optional[discord.Mess
|
|||||||
return ping
|
return ping
|
||||||
|
|
||||||
|
|
||||||
|
def reformat_description(description: str) -> str:
|
||||||
|
split_description = description.split("\n")
|
||||||
|
|
||||||
|
for index, line in enumerate(split_description):
|
||||||
|
if line.startswith("-"):
|
||||||
|
split_description[index] = "➣" + line[1:]
|
||||||
|
|
||||||
|
return "\n".join(split_description)
|
||||||
|
|
||||||
|
|
||||||
class AnnouncementCog(commands.Cog, name="Announcements"):
|
class AnnouncementCog(commands.Cog, name="Announcements"):
|
||||||
def __init__(self, bot: commands.Bot) -> None:
|
def __init__(self, bot: commands.Bot) -> None:
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
@@ -116,7 +126,9 @@ class Announcement:
|
|||||||
setattr(self, option.id, converted_value)
|
setattr(self, option.id, converted_value)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if option.id == "channel":
|
if option.id == "description":
|
||||||
|
converted_value = reformat_description(value)
|
||||||
|
elif option.id == "channel":
|
||||||
if value.startswith("#"):
|
if value.startswith("#"):
|
||||||
value = value[1:]
|
value = value[1:]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user