mirror of https://github.com/stijndcl/didier
commit
69fedb1428
|
@ -66,25 +66,30 @@ class Events(commands.Cog):
|
|||
if not checks.freeGamesCheck(message):
|
||||
await self.failedChecksCog.freeGames(message)
|
||||
|
||||
# Log commands in terminal
|
||||
if any(message.content.lower().startswith(pre) for pre in self.client.prefixes):
|
||||
DM = message.guild is None
|
||||
print("{} in {}: {}".format(message.author.display_name,
|
||||
"DM" if DM else "{} ({})".format(message.channel.name, message.guild.name),
|
||||
message.content))
|
||||
|
||||
# Boos React to people that call him Dider
|
||||
if "dider" in message.content.lower() and str(message.author.id) not in [constants.myId, constants.didierId]:
|
||||
if "dider" in message.content.lower() and str(message.author.id) not in [constants.myId, constants.didierId, constants.coolerDidierId]:
|
||||
await message.add_reaction("<:boos:629603785840263179>")
|
||||
|
||||
# Check for other easter eggs
|
||||
eER = easterEggResponses.control(message)
|
||||
eER = easterEggResponses.control(self.client, message)
|
||||
if eER:
|
||||
await message.channel.send(eER)
|
||||
|
||||
# Earn XP & Message count
|
||||
stats.sentMessage(message)
|
||||
|
||||
@commands.Cog.listener()
|
||||
async def on_command(self, ctx):
|
||||
"""
|
||||
Function called whenever someone invokes a command.
|
||||
Logs commands in your terminal.
|
||||
:param ctx: Discord Context
|
||||
"""
|
||||
DM = ctx.guild is None
|
||||
print("{} in {}: {}".format(ctx.author.display_name,
|
||||
"DM" if DM else "{} ({})".format(ctx.channel.name, ctx.guild.name),
|
||||
ctx.message.content))
|
||||
|
||||
@commands.Cog.listener()
|
||||
async def on_command_error(self, ctx, err):
|
||||
"""
|
||||
|
|
|
@ -2,6 +2,7 @@ from enum import Enum
|
|||
|
||||
myId = "171671190631481345"
|
||||
didierId = "680510935164911730"
|
||||
coolerDidierId = "728361496874057812"
|
||||
botIDs = [
|
||||
"155149108183695360",
|
||||
"234395307759108106",
|
||||
|
@ -43,6 +44,8 @@ creationDate = 1582243200
|
|||
|
||||
holidayAPIKey = "af4e1ebe-465d-4b93-a828-b95df18e6424"
|
||||
|
||||
prefixes = ["big d", "didier"]
|
||||
|
||||
|
||||
class Live(Enum):
|
||||
CallOfCode = "626699611192688641"
|
||||
|
|
|
@ -1,23 +1,18 @@
|
|||
import discord
|
||||
from discord.ext import commands
|
||||
from dotenv import load_dotenv
|
||||
from functions.prefixes import get_prefix
|
||||
import os
|
||||
|
||||
|
||||
load_dotenv(verbose=True)
|
||||
|
||||
|
||||
# All possible prefixes
|
||||
# When_mentioned_or doesn't count for spaces so can't use that
|
||||
prefixes = ["didier ", "Didier ", "DIDIER ", "big d ", "Big d ", "Big D ", "BIG D ", "<@!680510935164911730> ",
|
||||
"didier", "Didier", "DIDIER", "big d", "Big d", "Big D", "BIG D", "<@!680510935164911730>"]
|
||||
|
||||
# Configure intents (1.5.0)
|
||||
intents = discord.Intents.default()
|
||||
intents.members = True
|
||||
|
||||
client = commands.Bot(command_prefix=prefixes, case_insensitive=True, intents=intents)
|
||||
client.prefixes = prefixes
|
||||
client = commands.Bot(command_prefix=get_prefix, case_insensitive=True, intents=intents)
|
||||
|
||||
# Remove default help because it sucks & I made my own
|
||||
client.remove_command("help")
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
from data import constants
|
||||
import random
|
||||
|
||||
from data import constants
|
||||
|
||||
|
||||
def control(message):
|
||||
def control(bot, message):
|
||||
if str(message.author.id) == constants.didierId:
|
||||
return ""
|
||||
elif didier(message.content):
|
||||
elif didier(bot, message.content):
|
||||
return "Hmm?"
|
||||
elif any(term in message.content for term in ["gib dink", "gib donk"]):
|
||||
return "No."
|
||||
elif didier(message.content.split(" ")[0]) and any(term in message.content.lower() for term in ["are you sure", "are u sure"]):
|
||||
elif didier(bot, message.content.split(" ")[0]) and any(term in message.content.lower() for term in ["are you sure", "are u sure"]):
|
||||
return "I'm not just sure, I'm HIV Positive."
|
||||
elif any(message.content.lower().startswith(term) for term in ["is this", "isthis", "isdis", "is dis"]):
|
||||
res = random.randint(0, 100)
|
||||
|
@ -24,6 +23,6 @@ def control(message):
|
|||
return ""
|
||||
|
||||
|
||||
def didier(message):
|
||||
def didier(bot, message):
|
||||
ml = message.lower()
|
||||
return ml == "didier" or ml == "<@!{}>".format(constants.didierId)
|
||||
return ml in constants.prefixes or ml == "<@!{}>".format(bot.user.id)
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
from data.constants import prefixes
|
||||
from discord.ext import commands
|
||||
import os
|
||||
|
||||
|
||||
fallback = os.urandom(32).hex()
|
||||
|
||||
|
||||
def get_prefix(bot: commands.Bot, message):
|
||||
content = message.content.lower()
|
||||
mention = "<@!{}>".format(bot.user.id)
|
||||
|
||||
# Used @Didier
|
||||
if content.startswith(mention):
|
||||
if content.startswith(mention + " "):
|
||||
return mention + " "
|
||||
return mention
|
||||
|
||||
# Used a prefix
|
||||
for prefix in prefixes:
|
||||
# Find correct prefix
|
||||
if content.startswith(prefix):
|
||||
# Check if a space has to be added to invoke commands
|
||||
if content.startswith(prefix + " "):
|
||||
return prefix + " "
|
||||
return prefix
|
||||
|
||||
return fallback
|
Loading…
Reference in New Issue