Skip to content

Commit c92d3a0

Browse files
authored
Merge pull request #10 from LarssJakobsons/dev-v4-unstable
Epic merge
2 parents a2f0cb0 + 001ba0d commit c92d3a0

File tree

2 files changed

+46
-62
lines changed

2 files changed

+46
-62
lines changed

app.py

+46-58
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,12 @@
116116
soup = bs(html, 'html.parser')
117117

118118
# for i in range(len(epiccontribbutingppl)):
119-
# url_links_contributors.append((bot.get_user(epiccontribbutingppl[i])).avatar.url)
120-
# usernames_contributors.append((bot.get_user(epiccontribbutingppl[i])).name)
119+
# url_links_contributors.append((bot.fetch_user(epiccontribbutingppl[i])).avatar.url)
120+
# usernames_contributors.append((bot.fetch_user(epiccontribbutingppl[i])).name)
121121

122122
# for id in lilhelpers:
123-
# url_links_lilhelpers.append((bot.get_user(lilhelpers[i])).avatar.url)
124-
# usernames_lilhelpers.append((bot.get_user(lilhelpers[i])).name)
123+
# url_links_lilhelpers.append((bot.fetch_user(lilhelpers[i])).avatar.url)
124+
# usernames_lilhelpers.append((bot.fetch_user(lilhelpers[i])).name)
125125

126126
html = f"""
127127
<table>
@@ -130,6 +130,7 @@
130130

131131
@listen()
132132
async def on_startup():
133+
133134
print(f"{bot.user} has connected to Discord!")
134135
# bot.load_extension("data.voice")
135136
bot.load_extension("data.ext1") # Load all games
@@ -150,7 +151,8 @@ async def on_startup():
150151

151152
for lilhelper in lilhelpers:
152153
lilhelp_icons.append(bot.get_user(lilhelper).avatar.url)
153-
lilhelp_usernames.append(bot.get_user(lilhelp_usernames).username)
154+
lilhelp_usernames.append(bot.get_user(lilhelper).username)
155+
154156

155157

156158
# with open("index.html", "wb") as f:
@@ -298,8 +300,12 @@ async def info(ctx):
298300
@listen()
299301
async def on_component(ctx: ComponentContext):
300302
event = ctx.ctx
301-
if event.custom_id == "contributors":
302-
if event.channel.id not in channel_cooldown:
303+
match event.custom_id:
304+
case "contributors":
305+
message_components = event.message.components
306+
message_components[0].components[0].disabled = True
307+
await event.message.edit(components=message_components)
308+
303309
embed = Embed(
304310
title="⭐ Contributors",
305311
description=f"Awesome people who have helped to make Larss_Bot what it is today!",
@@ -328,17 +334,12 @@ async def on_component(ctx: ComponentContext):
328334
value=value,
329335
)
330336
await event.send(embed=embed, components=[delete_btn])
331-
channel_cooldown.append(event.channel.id)
332-
await asyncio.sleep(15)
333-
channel_cooldown.remove(event.channel.id)
334-
else:
335-
await event.send(
336-
"Looks like someone already pressed the button. No need to do it again.",
337-
ephemeral=True,
338-
)
339337

340-
if event.custom_id == "guildsinvites":
341-
if event.channel.id not in invite_cooldown:
338+
case "guildsinvites":
339+
message_components = event.message.components
340+
message_components[0].components[1].disabled = True
341+
await event.message.edit(components=message_components)
342+
342343
embed = Embed(
343344
title="Partner servers",
344345
description=f"Press any of the buttons below to get invited to one of the partnered servers",
@@ -367,49 +368,36 @@ async def on_component(ctx: ComponentContext):
367368
emoji="🐸",
368369
url="https://discord.gg/w78rcjW8ck",
369370
)
370-
components: list[ActionRow] = spread_to_rows(
371-
btn1,
372-
btn2,
373-
btn3,
374-
)
375-
components.append(ActionRow(delete_btn))
371+
components: list[ActionRow] = spread_to_rows(btn1, btn2, btn3)
372+
components.append(ActionRow(delete_btn))
376373

377374
await event.send(embed=embed, components=components)
378-
channel_cooldown.append(event.channel.id)
379-
await asyncio.sleep(15)
380-
channel_cooldown.remove(event.channel.id)
381-
else:
382-
# ephemeral not gonna work, once again
383-
await event.send(
384-
"Looks like someone already pressed the button. No need to do it again.",
385-
ephemeral=True,
386-
)
387-
# if event.custom_id == "extendedlistshow":
388-
# if event.channel.id not in nameday_cooldown:
389-
# today = date.today().strftime("%m-%d")
390-
# embed = Embed(
391-
# title="Visi šodienas vārdi",
392-
# description="> " + "\n> ".join(namedays_ext[today]),
393-
# color=Color.from_rgb(255, 13, 13),
394-
# )
395-
# await event.send(embed=embed)
396-
# nameday_cooldown.append(event.channel.id)
397-
# await asyncio.sleep(15)
398-
# nameday_cooldown.remove(event.channel.id)
399-
# else:
400-
# # ephemeral not gonna work, once again
401-
# await event.send(
402-
# "Looks like someone already pressed the button. No need to do it again.",
403-
# ephemeral=True,
404-
# )
405-
if event.custom_id == "delete":
406-
if (
407-
event.message.interaction._user_id == event.author.id
408-
or event.author.has_permission(Permissions.MANAGE_MESSAGES) == True
409-
):
410-
await event.message.delete()
411-
else:
412-
await event.send("Not your interaction.", ephemeral=True)
375+
# if event.custom_id == "extendedlistshow":
376+
# if event.channel.id not in nameday_cooldown:
377+
# today = date.today().strftime("%m-%d")
378+
# embed = Embed(
379+
# title="Visi šodienas vārdi",
380+
# description="> " + "\n> ".join(namedays_ext[today]),
381+
# color=Color.from_rgb(255, 13, 13),
382+
# )
383+
# await event.send(embed=embed)
384+
# nameday_cooldown.append(event.channel.id)
385+
# await asyncio.sleep(15)
386+
# nameday_cooldown.remove(event.channel.id)
387+
# else:
388+
# # ephemeral not gonna work, once again
389+
# await event.send(
390+
# "Looks like someone already pressed the button. No need to do it again.",
391+
# ephemeral=True,
392+
# )
393+
case "delete":
394+
if (
395+
event.message.interaction._user_id == event.author.id
396+
or event.author.has_permission(Permissions.MANAGE_MESSAGES)
397+
):
398+
await event.message.delete()
399+
else:
400+
await event.send("Not your interaction.", ephemeral=True)
413401

414402
@slash_command(name="ping", description="check the bots status")
415403
async def ping(ctx):

templates/index.html

-4
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ <h1>Larss_Bot <img src=https://cdn.discordapp.com/attachments/983081269543993354
1515
<li onclick="window.location.href = 'https://github.com/LarssJakobsons/Larss_Bot/'">Github Repository</li>
1616
<p>This is the website for Larss_Bot a discord bot made by <a src="https://github.com/LarssJakobsons">@Larss_J</a>. </p>
1717

18-
<table id="contributors">
19-
</table>
20-
<table id="lilhelpers">
21-
</table>
2218
</body>
2319

2420
</html>

0 commit comments

Comments
 (0)