2022-02-10 19:55:04 +01:00
|
|
|
import discord
|
2021-06-19 23:08:42 +02:00
|
|
|
from discord.ext import commands
|
2021-06-22 00:36:22 +02:00
|
|
|
|
|
|
|
from data.embeds.snipe import EditSnipe, DeleteSnipe
|
2022-02-11 22:54:40 +01:00
|
|
|
from data.links import get_link_for
|
2021-06-19 23:08:42 +02:00
|
|
|
from data.menus import custom_commands
|
2021-06-22 00:36:22 +02:00
|
|
|
from data.snipe import Action, Snipe
|
2021-06-19 23:08:42 +02:00
|
|
|
from decorators import help
|
|
|
|
from enums.help_categories import Category
|
2022-02-11 23:08:28 +01:00
|
|
|
from functions.utils import reply_to_reference
|
2021-06-22 00:36:22 +02:00
|
|
|
from startup.didier import Didier
|
2021-06-19 23:08:42 +02:00
|
|
|
|
|
|
|
|
|
|
|
class Other(commands.Cog):
|
2021-06-22 00:36:22 +02:00
|
|
|
def __init__(self, client: Didier):
|
|
|
|
self.client: Didier = client
|
2021-06-19 23:08:42 +02:00
|
|
|
|
2022-02-06 01:34:00 +01:00
|
|
|
# Don't allow any commands to work when locked
|
|
|
|
def cog_check(self, _):
|
|
|
|
return not self.client.locked
|
2021-06-19 23:08:42 +02:00
|
|
|
|
2022-02-11 22:54:40 +01:00
|
|
|
@commands.command(name="Link", usage="[Naam]")
|
|
|
|
@help.Category(category=Category.Other)
|
2022-02-11 23:08:28 +01:00
|
|
|
async def link(self, ctx: commands.Context, name: str):
|
2022-02-11 22:54:40 +01:00
|
|
|
"""
|
|
|
|
Send commonly used links
|
|
|
|
"""
|
|
|
|
match = get_link_for(name)
|
|
|
|
|
|
|
|
if match is None:
|
|
|
|
return await ctx.reply(f"Geen match gevonden voor \"{name}\".", mention_author=False, delete_after=15)
|
|
|
|
|
2022-02-11 23:08:28 +01:00
|
|
|
await reply_to_reference(ctx, content=match)
|
2022-02-11 22:54:40 +01:00
|
|
|
|
2021-06-19 23:08:42 +02:00
|
|
|
@commands.command(name="Custom")
|
|
|
|
@help.Category(category=Category.Didier)
|
|
|
|
async def list_custom(self, ctx):
|
|
|
|
"""
|
|
|
|
Get a list of all custom commands
|
|
|
|
"""
|
2022-02-06 01:34:00 +01:00
|
|
|
await custom_commands.CommandsList(ctx).send()
|
2021-06-19 23:08:42 +02:00
|
|
|
|
2022-02-10 19:55:04 +01:00
|
|
|
@commands.command(name="Join", usage="[Thread]")
|
|
|
|
@help.Category(category=Category.Didier)
|
|
|
|
async def join_thread(self, ctx, thread: discord.Thread):
|
|
|
|
"""
|
|
|
|
Join threads
|
|
|
|
"""
|
|
|
|
if thread.me is None:
|
|
|
|
await thread.join()
|
|
|
|
await ctx.message.add_reaction("✅")
|
|
|
|
|
2021-06-22 00:36:22 +02:00
|
|
|
@commands.command(name="Snipe")
|
|
|
|
@help.Category(category=Category.Other)
|
|
|
|
async def snipe(self, ctx):
|
|
|
|
"""
|
|
|
|
Shame people for editing & removing messages.
|
|
|
|
The dict is stored in memory so it will be cleared whenever the bot restarts.
|
|
|
|
"""
|
|
|
|
if ctx.guild is None:
|
|
|
|
return
|
|
|
|
|
|
|
|
if ctx.channel.id not in self.client.snipe:
|
|
|
|
return await ctx.send("Er is hier niemand om uit te lachen.")
|
|
|
|
|
|
|
|
s: Snipe = self.client.snipe[ctx.channel.id]
|
|
|
|
|
|
|
|
embed_class = (EditSnipe(s) if s.action == Action.Edit else DeleteSnipe(s))
|
|
|
|
|
|
|
|
return await ctx.send(embed=embed_class.to_embed(self.client))
|
|
|
|
|
2021-06-19 23:08:42 +02:00
|
|
|
|
|
|
|
def setup(client):
|
|
|
|
client.add_cog(Other(client))
|