#How to go about getting a list of ids that respond to a message sent out
1 messages · Page 1 of 1 (latest)
thanks, how do I give my bot permission to send dms?
You can use member.send to send a message to them in dms
users = await sent_embed.fetch_reactions_for_emoji(<channel_id>, message, "emoji")
for user in users:
await user.send('Thanks for reacting!')
Like this?
sent_embed = await message.respond(embed) # message object
await asyncio.sleep(endtime_int) # wait for the end of a timer
users = await sent_embed.fetch_reactions_for_emoji(1006722737668104325, embed, "moneybag") # collect users reactions to message object with moneybag emoji
for user in users: #loop thry users
await user.send('Thanks for reacting!') #send dm to each user who reacted
I wrote comments on it so I can understand what's going on, but am I missing something?
Have a look at what fetch_reactions_for_emoji returns and check if it's like that :)
That should work
And I recommend you don't spam dm people btw
If I’m not mistaken it returns an object u can iterate through to fetch the users that reacted to the message
That’s strange then bc when I check by printing my users variable I don’t see anything in the console
How do you mean
Don't DM everyone that joined the giveaway, only DM that one who won (or just ping them in the same channel)
It makes no sense to DM them all
Oh yeah yeah I’m just testing to see that it works
That "moneybag" is wrong. Google the unicode emoji literal and paste it there
will do!
I don't think it worked
I mean, considering you have a sleep before it, idk
ooooo
I took out that line and got an error
ResponseProxy object has no attribute fetch_reactions_for_emoji
I'm assuming its referring to my message in the form of an embed?
Does it have something to do with the way the message is sent to the channel by the bot? I'm not sure lol
Check lightbulb docs for how to get a message from a ResponseProxy
ah ok so i see that I can use .message() to return the response's created messsage
I reran it and now theres a new error
that has something to do with the function itself right?
await (await sent_embed.message()).whatever
interesting now it gives the error saying that the "Message" object doesn't have the attribute fetch_reactions_for_emoji
looking in the docs rn
Now I would need to figure out how to get the snowflake from the ResponseProxy to pass into fetch_reactions
So to do this would it be something like: sent_embed.message().id() ?
where I turn the proxy into a message object and then get the id of the message obejct?
I tried the above and the result is this:
also, I get this warning
same thing as here
ok so a couple of things happened
I got this error and realized emd_msg is a snowflake object and so I passed it into the fetch method
I fixed that (yay) then I got this error:
It said 'Unknown Emoji' so i replaced it with the actual emoji again
Then I got this error:
It says it got a list, which is what I'm expecting, so I took the async out for the for loop
Now it runs without errors, but it still doesn't send a dm 😭
Here is the code:
bot = lightbulb.BotApp(token='', intents=hikari.intents.Intents.GUILD_MESSAGE_REACTIONS, default_enabled_guilds=(1006722736074264677))
@bot.listen(hikari.StartedEvent)
async def on_started(event):
print('Bot has started')
@bot.listen(hikari.ReactionAddEvent)
async def get_reaction_user(event):
pass
#if not event.is_for_emoji('U+1F4B0'):
@bot.command()
@lightbulb.option('amount','how much robux?',type=int, min_value= 500)
@lightbulb.option('time','how many minutes?',type=int, min_value= 1)
@lightbulb.command('startrain', 'starts giveaway')
@lightbulb.implements(lightbulb.SlashCommand)
async def embed_msg(message):
rbux_val= message.options.amount # robux amount
rain_start = datetime.datetime.now() # datetime start time
rain_end = rain_start + timedelta(minutes=message.options.time) #datetime end time
endtime_int = int(rain_end.strftime("%Y%m%d%H%M%S")) #end time in secs
#Initialize Embed
embed = hikari.Embed(title="💸 Enter the ROBUX rain! 💸", #initialize embed
description="**RAIN AMOUNT:** " + str(rbux_val) +
"\n**RAIN ENDS: **" + "<t:"+ str(int((time.mktime(rain_end.timetuple()))))+ ":R>" +
"\n\nReact to enter the rain!",
color='#FFFF00'
)
embed.set_footer("ROBUX RAIN started by" + " " + message.author.username) # set footer
sent_embed = await message.respond(embed) # message object
embed_msg = await sent_embed.message()
#await asyncio.sleep(endtime_int) # wait for the end of a timer
users = await bot.rest.fetch_reactions_for_emoji(1006722737668104325, embed_msg, "💰") # collect users reactions to message object with moneybag emoji
for user in users: #loop thru users
await user.send('Thanks for reacting!') #send dm to each user who reacted
bot.run()
print what users is and see if its empty or what @stiff gyro
its empty
which is weird cause I reacted to it