experimental: add emoji text with modal and context menu
This commit is contained in:
parent
3639de8217
commit
4e4cf48e60
1 changed files with 15 additions and 3 deletions
20
bot.py
20
bot.py
|
@ -9,6 +9,7 @@ from os import environ
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
from discord.commands import Option
|
from discord.commands import Option
|
||||||
from discord.commands import permissions
|
from discord.commands import permissions
|
||||||
|
from discord.ui import InputText, Modal
|
||||||
|
|
||||||
def left(s, amount):
|
def left(s, amount):
|
||||||
return s[:amount]
|
return s[:amount]
|
||||||
|
@ -152,11 +153,22 @@ async def gmroll(ctx,
|
||||||
em = discord.Embed(title=rolle, description=rolltotal, colour=0x009933)
|
em = discord.Embed(title=rolle, description=rolltotal, colour=0x009933)
|
||||||
await ctx.response.send_message(embed=em, ephemeral=True)
|
await ctx.response.send_message(embed=em, ephemeral=True)
|
||||||
|
|
||||||
@bot.message_command(name="Emoji Text", guild_ids=[261575556708040705])
|
class MyModal(Modal):
|
||||||
async def emoji_text(ctx, message: discord.Message):
|
def __init__(self) -> None:
|
||||||
emojitext = "shiba"
|
super().__init__("Emojitext")
|
||||||
|
self.add_item(InputText(label="Dein Text:", placeholder="Jeder Buchstabe nur einmal!"))
|
||||||
|
|
||||||
|
async def callback(self, interaction: discord.Interaction):
|
||||||
|
emojitext = self.children[0].value.lower.strip
|
||||||
for x in list(emojitext):
|
for x in list(emojitext):
|
||||||
await message.add_reaction(alphabet[x])
|
await interaction.message.add_reaction(alphabet[x])
|
||||||
|
await interaction.response.send_message(content="done", ephemeral=True)
|
||||||
|
|
||||||
|
@bot.message_command(name="Emoji Text", guild_ids=[261575556708040705])
|
||||||
|
@permissions.has_role(member_role)
|
||||||
|
async def emoji_text(ctx, message: discord.Message):
|
||||||
|
modal = MyModal()
|
||||||
|
await ctx.interaction.response.send_modal(modal)
|
||||||
|
|
||||||
@bot.command(help="veraltet", usage="", hidden=True)
|
@bot.command(help="veraltet", usage="", hidden=True)
|
||||||
@is_member()
|
@is_member()
|
||||||
|
|
Loading…
Add table
Reference in a new issue