#How to send ephemeral view in dm channel

1 messages · Page 1 of 1 (latest)

silver plaza
#

I can send an ephemeral view in a guild channel but in dm it isn't ephemeral, what's the issue in my code? Commented out line works in a guild channel

@plugin.command
@Raids.child
@lightbulb.command('create', 'Create a new raid')
@lightbulb.implements(lightbulb.SlashSubCommand)
async def NewRaid(ctx):
    await ctx.respond('I sent you a direct message, please follow the instructions there to create your raid!', flags=hikari.MessageFlag.EPHEMERAL)
    channel = await plugin.bot.rest.create_dm_channel(ctx.member.id)
    raid = Raid()
    raid.datetime = dt.datetime.now(tz=datetime.timezone.utc)
    raid.host = ctx.member.user.id
    raid.hostDisplay = ctx.member.display_name
    ActiveRaids.append(raid)
    view = RaidSelectView(raid=raid)
    message = await channel.send("", components=view, flags=hikari.MessageFlag.EPHEMERAL)
    # message = await ctx.respond("", components=view, flags=hikari.MessageFlag.EPHEMERAL)
    await view.start(message)
humble wedge
#

why do you want an Ephemeral message in a dm though

silver plaza
#

Because I don't want this

humble wedge
#

ah

#

well I dont know if they work, but if it works in a guild, and not in dm's, chances are you cant have them

silver plaza
#

it's only the view though

#

a normal message and embeds work

humble wedge
#

okay

#

channel.send cannot be ephemeral

#

it can only be ephemeral when responding to an interaction

silver plaza
#

hm I see

#

well because of the field limits in embeds I was gonna go back to a guild channel

#

so I guess it works out

humble wedge
#

like:

await ctx.respond("beans")

you are responding to an interaction, therefore you can set it as ephemeral

await channel.send("beans")

this is just sending a message with no response to anything, because you are "sending" not "responding" to something

silver plaza
#

yes but you can only respond once, ig I can send the first message normally and respond with the view though

humble wedge
#

you have to respond in the same channel

#

so from what I can tell, your only options really, is to either delete it after a set amount of time (either no interaction, or from creation) or a button to delete it

silver plaza
#

makes sense

humble wedge
#

unless the command is run in the dms

#

thats different

silver plaza
#

no its ran from the guild

humble wedge
#

orrrrr, you could create a message in the dm with a button that has "continue" on it or something, and then when the button is pressed, it deletes the message, responds with an ephemeral message with the content you want

#

but sadly for that you need an extra step

silver plaza
#

yeah too much overengineering

#

just gonna post it in guild

humble wedge
#

this is the issue with bots xD

#

everything can get very complicated, very quickly

silver plaza
#

yeah to solve my embed field limit issue I was told paginators

humble wedge
#

yup

silver plaza
#

and I don't even know where to start solving the issues it creates for me

#

so nvm that

humble wedge
#

did you create your own or use something like mirus?

silver plaza
#

I use miru

humble wedge
#

ah fair, same here

silver plaza
#

but for my use user would post the classes they want in their raid

humble wedge
#

I made a bot in java and had to make my own pagination system, that was a nightmare

silver plaza
#

need to get the index from embed field

#

with mutliple embeds idk

humble wedge
#

yes yes, you do have to modify it quite a bit for that

silver plaza
#

y so nvm user will just post the emojis in chat

#

much simpler

humble wedge
#

what about reactions

silver plaza
#

I have 37 emojis

#

thats too many for 1 message

humble wedge
#

oh I mean the user adds the one needed

silver plaza
#

oh

humble wedge
#

just another thought

silver plaza
#

I wouldnt need to find a way to listen for the message with reactions y

silver plaza
#

@humble wedge any idea why I don't get any reaction?

class RaidDdSelectView(miru.View):
    def __init__(self, *, timeout: float | int | None = 120, autodefer: bool = True, raid: Raid) -> None:
        super().__init__(timeout=timeout, autodefer=autodefer)
        self.raid = raid
    @miru.button(label="Done", style=hikari.ButtonStyle.SUCCESS)
    async def button(self, button: miru.Button, ctx: miru.ViewContext) -> None:
        list = await plugin.bot.rest.fetch_guild_emojis(1118540448600948847)
        for reaction in self.message.reactions:
            print('yo')
            if any(reaction.emoji == x for x in list):
                if any(reaction.emoji.name == y for y in RangedEmojis) or any(reaction.emoji.name == y for y in MeleeEmojis) or any(reaction.emoji.name == y for y in MagicEmojis):
                    self.raid.ddoptions.append(reaction.emoji)
        view = RaidSuppSelectView(raid=self.raid)
        message = await ctx.respond("React to this message with the **support** emojis you want in your raid, click the button when you're done. Only use emojis from this server!", components=view)
        await view.start(message)
humble wedge
#

im not totally sure. I would suggest printing values like self.message.reactions, or try fetching the message and seeing if you get different results