Skip to content

fixed welcome, staff update, source cmd #76

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions cogs/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
from discord.ext import commands
from ext.helpers import UrbanDefinition, UrbanDictionary

from ext.consts import STAFF_UPDATE_CHANNEL_ID

if TYPE_CHECKING:
from ext.models import CodingBot

Expand Down Expand Up @@ -36,8 +38,8 @@ async def _source(
`{prefix}source [command] [subcommand]`:
*will send link to the source code of the subcommand*
"""
github = "<:githubwhite:804344724621230091>"
embed = discord.Embed(title=f"{github} GitHub (Click Here) {github}")
github = "https://i.imgur.com/NFwIx3d.png"
embed = discord.Embed(color = 0xfffffe)
source_url = "https://github.com/The-Coding-Realm/coding-bot-v6"
branch = "master"
if command is None:
Expand Down Expand Up @@ -78,7 +80,11 @@ async def _source(
f"{source_url}/blob/{branch}/{location}#L{firstlineno}-L"
f"{firstlineno + len(lines) - 1}"
)
embed.url = final_url
embed.set_author(
name = "GitHub (Click Here)",
icon_url = github,
url = final_url
)
await self.bot.reply(ctx, embed=embed)

@commands.hybrid_command(name="define")
Expand Down Expand Up @@ -172,7 +178,7 @@ async def avatar_display(
@commands.command(name="update-staff-list")
@commands.has_permissions(administrator=True)
async def update_staff_list(self, ctx):
staff_list_channel = self.bot.get_channel(765066298299383809)
staff_list_channel = self.bot.get_channel(STAFF_UPDATE_CHANNEL_ID)
mod_roles = [
681895373454835749,
838634262693412875,
Expand All @@ -189,8 +195,10 @@ async def update_staff_list(self, ctx):
valid_members = []
for m in r.members:
admin = m.top_role.name == "Admin Perms" and r.name == "Admin"
if m.top_role == r or admin:
motm = m.top_role.id == 760763132158803968
if m.top_role == r or admin or motm:
valid_members.append(m)


embed.description += f"{r.mention} | **{len(valid_members)}** \n"

Expand Down
3 changes: 2 additions & 1 deletion ext/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ def release_format(self):
MODMAIL_ROLE_ID = 788799215417032705
MODMAIL_OPEN = 1144842655671517305 # conch internal: 1144839090609602611
MODMAIL_CLOSED = 1144842686579359837 # conch: 1144839107353256017
STAFF_UPDATE_CHANNEL_ID = 1124612885365133412

# mods pls fill this up
TICKET_CATEGORY_ID = 0
TICKET_CATEGORY_ID = 0 # <--- this still hasn't been resolved but I don't think we need it ~ ayu
2 changes: 1 addition & 1 deletion ext/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def generate_image(self, member: discord.Member, **kwargs: Any) -> discord.File:
draw = ImageDraw.Draw(txt)
fill = (255, 255, 255, 255)
text = "Welcome to The Coding Realm"
text_width, _ = draw.textsize(text, self.font.get(25))
text_width = draw.textlength(text, self.font.get(25))
width_height = ((txt.size[0] - text_width) // 2, (txt.size[1] // 31) * 1)
draw.text(width_height, text, font=self.font.get(25), fill=fill, align="center")
text = str(member)
Expand Down