adding context menu for emoji text
This commit is contained in:
parent
6f902ce78b
commit
50afe4ab59
1 changed files with 25 additions and 0 deletions
25
bot.py
25
bot.py
|
@ -9,6 +9,7 @@ from os import environ
|
|||
from discord.ext import commands
|
||||
from discord.commands import Option
|
||||
from discord.commands import permissions
|
||||
from discord.ui import InputText, Modal
|
||||
|
||||
def left(s, amount):
|
||||
return s[:amount]
|
||||
|
@ -54,6 +55,7 @@ def is_gm():
|
|||
return commands.check(predicate)
|
||||
|
||||
emojinumbers = ["0\u20E3", "1\u20E3" , "2\u20E3" , "3\u20E3" , "4\u20E3" , "5\u20E3" , "6\u20E3" , "7\u20E3" , "8\u20E3" , "9\u20E3"]
|
||||
alphabet = {"a" : "🇦","b" : "🇧","c" : "🇨","d" : "🇩","e" : "🇪","f" : "🇫","g" : "🇬","h" : "🇭","i" : "🇮","j" : "🇯","k" : "🇰","l" : "🇱","m" : "🇲","n" : "🇳","o" : "🇴","p" : "🇵","q" : "🇶","r" : "🇷","s" : "🇸","t" : "🇹","u" : "🇺","v" : "🇻","w" : "🇼","x" : "🇽","y" : "🇾","z" : "🇿"}
|
||||
|
||||
bot.help_command = commands.DefaultHelpCommand(dm_help=False, no_category="Befehle die du nutzen kannst")
|
||||
|
||||
|
@ -154,6 +156,29 @@ async def gmroll(ctx,
|
|||
em = discord.Embed(title=rolle, description=rolltotal, colour=0x009933)
|
||||
await ctx.response.send_message(embed=em, ephemeral=True)
|
||||
|
||||
class MyModal(Modal):
|
||||
def __init__(self) -> None:
|
||||
self.message_id = 0
|
||||
super().__init__("Emojitext")
|
||||
self.add_item(InputText(label="Dein Text:", placeholder="Jeder Buchstabe nur einmal!"))
|
||||
def set_message_id(self, message_id):
|
||||
self.message_id = message_id
|
||||
async def callback(self, interaction: discord.Interaction):
|
||||
await interaction.response.send_message(content="Füge Reaktionen hinzu...", ephemeral=True)
|
||||
emojitext = self.children[0].value.lower()
|
||||
original_message = await interaction.channel.fetch_message(self.message_id)
|
||||
for x in list(emojitext):
|
||||
await original_message.add_reaction(alphabet[x])
|
||||
|
||||
|
||||
@bot.message_command(name="Emoji Text", guild_ids=[261575556708040705])
|
||||
@permissions.has_role(member_role)
|
||||
async def emoji_text(ctx, message: discord.Message):
|
||||
modal = MyModal()
|
||||
modal.title = "Emoji Bot"
|
||||
modal.set_message_id(message.id)
|
||||
await ctx.interaction.response.send_modal(modal)
|
||||
|
||||
@bot.command(help="veraltet", usage="", hidden=True)
|
||||
@is_member()
|
||||
async def yesno(ctx):
|
||||
|
|
Loading…
Reference in a new issue