mirror of https://github.com/stijndcl/didier
Compare commits
2 Commits
93ede132a2
...
a734191973
| Author | SHA1 | Date |
|---|---|---|
|
|
a734191973 | |
|
|
9a999fb34b |
|
|
@ -0,0 +1,32 @@
|
||||||
|
import discord
|
||||||
|
from discord import ApplicationContext
|
||||||
|
from discord.ext import commands
|
||||||
|
from discord.commands import message_command
|
||||||
|
|
||||||
|
from startup.didier import Didier
|
||||||
|
|
||||||
|
|
||||||
|
class SchoolCM(commands.Cog):
|
||||||
|
def __init__(self, client: Didier):
|
||||||
|
self.client: Didier = client
|
||||||
|
|
||||||
|
@message_command(name="Pin")
|
||||||
|
async def _pin_cm(self, ctx: ApplicationContext, message: discord.Message):
|
||||||
|
# In case people abuse, check if they're blacklisted
|
||||||
|
blacklist = []
|
||||||
|
|
||||||
|
if ctx.user.id in blacklist:
|
||||||
|
return await ctx.respond(":angry:", ephemeral=True)
|
||||||
|
|
||||||
|
if message.is_system():
|
||||||
|
return await ctx.respond("Dus jij wil system messages pinnen?\nMag niet.", ephemeral=True)
|
||||||
|
|
||||||
|
await message.pin(reason=f"Didier Pin door {ctx.user.display_name}")
|
||||||
|
await ctx.respond("📌", ephemeral=True)
|
||||||
|
|
||||||
|
|
||||||
|
def setup(client: Didier):
|
||||||
|
# client.add_cog(SchoolCM(client))
|
||||||
|
# TODO wait for bug to be fixed in lib then uncomment this
|
||||||
|
# when used in dm, tries to create a DM with the bot?
|
||||||
|
pass
|
||||||
|
|
@ -78,6 +78,12 @@ class Events(commands.Cog):
|
||||||
# Earn XP & Message count
|
# Earn XP & Message count
|
||||||
stats.sentMessage(message)
|
stats.sentMessage(message)
|
||||||
|
|
||||||
|
@commands.Cog.listener()
|
||||||
|
async def on_thread_join(self, thread: discord.Thread):
|
||||||
|
# Join threads automatically
|
||||||
|
if thread.me is None:
|
||||||
|
await thread.join()
|
||||||
|
|
||||||
@commands.Cog.listener()
|
@commands.Cog.listener()
|
||||||
async def on_command(self, ctx):
|
async def on_command(self, ctx):
|
||||||
"""
|
"""
|
||||||
|
|
@ -103,6 +109,7 @@ class Events(commands.Cog):
|
||||||
# Don't handle commands that have their own custom error handler
|
# Don't handle commands that have their own custom error handler
|
||||||
if hasattr(ctx.command, 'on_error'):
|
if hasattr(ctx.command, 'on_error'):
|
||||||
return
|
return
|
||||||
|
|
||||||
# Someone just mentioned Didier without calling a real command,
|
# Someone just mentioned Didier without calling a real command,
|
||||||
# don't care about this error
|
# don't care about this error
|
||||||
if isinstance(err, (commands.CommandNotFound, commands.CheckFailure, commands.TooManyArguments, commands.ExpectedClosingQuoteError), ):
|
if isinstance(err, (commands.CommandNotFound, commands.CheckFailure, commands.TooManyArguments, commands.ExpectedClosingQuoteError), ):
|
||||||
|
|
@ -114,9 +121,11 @@ class Events(commands.Cog):
|
||||||
await ctx.send("Geen message gevonden die overeenkomt met het opgegeven argument.")
|
await ctx.send("Geen message gevonden die overeenkomt met het opgegeven argument.")
|
||||||
elif isinstance(err, (commands.ChannelNotFound, commands.ChannelNotReadable)):
|
elif isinstance(err, (commands.ChannelNotFound, commands.ChannelNotReadable)):
|
||||||
await ctx.send("Geen channel gevonden dat overeenkomt met het opgegeven argument.")
|
await ctx.send("Geen channel gevonden dat overeenkomt met het opgegeven argument.")
|
||||||
|
elif isinstance(err, commands.ThreadNotFound):
|
||||||
|
await ctx.reply("Thread niet gevonden.", mention_author=False)
|
||||||
# Someone forgot an argument or passed an invalid argument
|
# Someone forgot an argument or passed an invalid argument
|
||||||
elif isinstance(err, (commands.BadArgument, commands.MissingRequiredArgument, commands.UnexpectedQuoteError)):
|
elif isinstance(err, (commands.BadArgument, commands.MissingRequiredArgument, commands.UnexpectedQuoteError)):
|
||||||
await ctx.send("Controleer je argumenten.")
|
await ctx.reply("Controleer je argumenten.", mention_author=False)
|
||||||
else:
|
else:
|
||||||
usage = stringFormatters.format_command_usage(ctx)
|
usage = stringFormatters.format_command_usage(ctx)
|
||||||
await self.sendErrorEmbed(err, "Command", usage)
|
await self.sendErrorEmbed(err, "Command", usage)
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import discord
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
|
|
||||||
from data.embeds.snipe import EditSnipe, DeleteSnipe
|
from data.embeds.snipe import EditSnipe, DeleteSnipe
|
||||||
|
|
@ -24,6 +25,16 @@ class Other(commands.Cog):
|
||||||
"""
|
"""
|
||||||
await custom_commands.CommandsList(ctx).send()
|
await custom_commands.CommandsList(ctx).send()
|
||||||
|
|
||||||
|
@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("✅")
|
||||||
|
|
||||||
@commands.command(name="Snipe")
|
@commands.command(name="Snipe")
|
||||||
@help.Category(category=Category.Other)
|
@help.Category(category=Category.Other)
|
||||||
async def snipe(self, ctx):
|
async def snipe(self, ctx):
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ class School(commands.Cog):
|
||||||
if message.is_system():
|
if message.is_system():
|
||||||
return await ctx.send("Dus jij wil system messages pinnen?\nMag niet.")
|
return await ctx.send("Dus jij wil system messages pinnen?\nMag niet.")
|
||||||
|
|
||||||
await message.pin(reason="Didier Pin door {}".format(ctx.author.display_name))
|
await message.pin(reason=f"Didier Pin door {ctx.author.display_name}")
|
||||||
await ctx.message.add_reaction("✅")
|
await ctx.message.add_reaction("✅")
|
||||||
|
|
||||||
@commands.command(name="Deadlines", aliases=["dl"])
|
@commands.command(name="Deadlines", aliases=["dl"])
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@
|
||||||
"inspire": "Genereer quotes via [InspiroBot](https://inspirobot.me/).",
|
"inspire": "Genereer quotes via [InspiroBot](https://inspirobot.me/).",
|
||||||
"inventory": "Bekijk de items in jouw inventory.",
|
"inventory": "Bekijk de items in jouw inventory.",
|
||||||
"invest": "Investeer [Aantal] Didier Dinks in jouw Didier Bank om rente te vergaren.",
|
"invest": "Investeer [Aantal] Didier Dinks in jouw Didier Bank om rente te vergaren.",
|
||||||
|
"join": "Laat Didier [Thread] joinen.",
|
||||||
"jpl": "Informatie over de Jupiler Pro League.",
|
"jpl": "Informatie over de Jupiler Pro League.",
|
||||||
"jpl matches": "Bekijk de wedstrijden die gespeeld worden op [Week]. Default naar de huidige speeldag.",
|
"jpl matches": "Bekijk de wedstrijden die gespeeld worden op [Week]. Default naar de huidige speeldag.",
|
||||||
"jpl table": "De huidige stand van het klassement.",
|
"jpl table": "De huidige stand van het klassement.",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue