mirror of https://github.com/stijndcl/didier
Add command that shows how many (& which) characters can be used for react
parent
c882179b0d
commit
9d3f71eb1f
|
@ -51,6 +51,25 @@ class ReactWord(commands.Cog):
|
|||
for reac in arr:
|
||||
await message.add_reaction(reac)
|
||||
|
||||
@commands.command(name="Character", aliases=["Char"], usage="[Karakter]")
|
||||
@help.Category(category=Category.Other)
|
||||
async def char(self, ctx, char: str = None):
|
||||
# Nothing passed
|
||||
if char is None:
|
||||
return await ctx.send("Controleer je argumenten")
|
||||
|
||||
char = char.lower()
|
||||
|
||||
# Not 1 char passed
|
||||
if len(char) != 1 or char not in reactWord.allowedCharacters():
|
||||
return await ctx.send("Dit is geen geldig karakter.")
|
||||
|
||||
var = reactWord.getAllVariants(char)
|
||||
|
||||
return await ctx.send("**Karakter**: {}\nOpties (**{}**): {}".format(
|
||||
char, len(var), " ".join(var)
|
||||
))
|
||||
|
||||
|
||||
def setup(client):
|
||||
client.add_cog(ReactWord(client))
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
"bitcoin sell": "Verkoop [Aantal] Bitcoins.",
|
||||
"buy": "Koop [Aantal] van [Item id] uit de Store.\nIndien je geen aantal opgeeft, is dit standaard 1.",
|
||||
"changelog": "Stuurt links naar de Didier Changelogs.",
|
||||
"character": "Toont een lijst van opties van emoji's die Didier React kan gebruiken voor [Karakter], zodat je kan zien hoeveel (en welke) karakters gebruikt kunnen worden.",
|
||||
"clap": "Zet \"Tekst\" om naar :clap: \uD83C\uDDF9 :clap: \uD83C\uDDEA :clap: \uD83C\uDDF0 :clap: \uD83C\uDDF8 :clap: \uD83C\uDDF9 :clap:",
|
||||
"coinflip": "Gooi een muntje, indien je Didier Dinks inzet kan je je inzet verdubbelen (of verliezen).",
|
||||
"config": "Past constanten in het config bestand aan.",
|
||||
|
|
|
@ -259,4 +259,38 @@ def getUnicodeDict():
|
|||
"asterisk": "*️⃣"
|
||||
}
|
||||
|
||||
return unidic
|
||||
return unidic
|
||||
|
||||
|
||||
# Returns a list of all emoji's that exist for a char
|
||||
def getAllVariants(char: str):
|
||||
variants = []
|
||||
|
||||
# Letter
|
||||
reg_ind = "regional_indicator_{}".format(char)
|
||||
if reg_ind in getUnicodeDict():
|
||||
variants.append(reg_ind)
|
||||
|
||||
# Number
|
||||
elif char in getNumbers():
|
||||
variants.append(getNumbers()[char])
|
||||
|
||||
# Special Character
|
||||
elif char in getSpecialCharacters():
|
||||
variants.append(getSpecialCharacters()[char])
|
||||
|
||||
# Get all doubles
|
||||
if char in getDoubles():
|
||||
for letter in getDoubles()[char]:
|
||||
variants.append(letter)
|
||||
|
||||
# Remove doubles that might have slipped in
|
||||
# Use a list here to keep the order!
|
||||
uniques = []
|
||||
|
||||
for var in variants:
|
||||
rep = ":" + var + ":"
|
||||
if rep not in uniques:
|
||||
uniques.append(rep)
|
||||
|
||||
return uniques
|
||||
|
|
Loading…
Reference in New Issue