116
116
soup = bs (html , 'html.parser' )
117
117
118
118
# 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)
121
121
122
122
# 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)
125
125
126
126
html = f"""
127
127
<table>
130
130
131
131
@listen ()
132
132
async def on_startup ():
133
+
133
134
print (f"{ bot .user } has connected to Discord!" )
134
135
# bot.load_extension("data.voice")
135
136
bot .load_extension ("data.ext1" ) # Load all games
@@ -150,7 +151,8 @@ async def on_startup():
150
151
151
152
for lilhelper in lilhelpers :
152
153
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
+
154
156
155
157
156
158
# with open("index.html", "wb") as f:
@@ -298,8 +300,12 @@ async def info(ctx):
298
300
@listen ()
299
301
async def on_component (ctx : ComponentContext ):
300
302
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
+
303
309
embed = Embed (
304
310
title = "⭐ Contributors" ,
305
311
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):
328
334
value = value ,
329
335
)
330
336
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
- )
339
337
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
+
342
343
embed = Embed (
343
344
title = "Partner servers" ,
344
345
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):
367
368
emoji = "🐸" ,
368
369
url = "https://discord.gg/w78rcjW8ck" ,
369
370
)
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 ))
376
373
377
374
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 )
413
401
414
402
@slash_command (name = "ping" , description = "check the bots status" )
415
403
async def ping (ctx ):
0 commit comments