Closed m00nm00nm00n closed 2 years ago
$embed = new Embed($discord);
$embed
->setAuthor('Whale Watchers Bot', 'https://cdn.discordapp.com/app-icons/380557100906184716/1e785e9964b7e72fb401f09708d5bc1d.webp?size=128')
->setColor('#32a854')
->setTitle('Dingaling Bought Cosmic Zxdiac - Sagittarius - Open Sea Collection')
->setUrl('https://opensea.io/assets/0x495f947276749ce646f68ac8c248420045cb7b5e/80494307024529346018053650490912529916739680814770830097664395980124115173670')
->addFieldValues('Price', '0.0Ξ')
->setImage('https://lh3.googleusercontent.com/Dl16SwK9HwhYI0nV-sb1fTvM78uupzwrV-MBF044XGhqYpTFZd8agt_ZOoAIDnnZ2UjN4gSlKvRL6Ueeq6mOaZYxYDNwNOnLuRAwmA=s0')
->setFooter('Sold on OpenSea', 'https://storage.googleapis.com/opensea-static/Logomark/Logomark-White.png')
->setTimestamp(strtotime('01/17/2022'));
$builder = MessageBuilder::new()->addEmbed($embed);
$channel->sendMessage($builder);
$embed = new Embed($discord); $embed ->setAuthor('Whale Watchers Bot', 'https://cdn.discordapp.com/app-icons/380557100906184716/1e785e9964b7e72fb401f09708d5bc1d.webp?size=128') ->setColor('#32a854') ->setTitle('Dingaling Bought Cosmic Zxdiac - Sagittarius - Open Sea Collection') ->setUrl('https://opensea.io/assets/0x495f947276749ce646f68ac8c248420045cb7b5e/80494307024529346018053650490912529916739680814770830097664395980124115173670') ->addFieldValues('Price', '0.0Ξ') ->setImage('https://lh3.googleusercontent.com/Dl16SwK9HwhYI0nV-sb1fTvM78uupzwrV-MBF044XGhqYpTFZd8agt_ZOoAIDnnZ2UjN4gSlKvRL6Ueeq6mOaZYxYDNwNOnLuRAwmA=s0') ->setFooter('Sold on OpenSea', 'https://storage.googleapis.com/opensea-static/Logomark/Logomark-White.png') ->setTimestamp(strtotime('01/17/2022')); $builder = MessageBuilder::new()->addEmbed($embed); $channel->sendMessage($builder);
Thanks for taking the time to write this - my question though is how do you incorporate this into a 2 way messaging bot?
with the 2 way bot I just use $message->reply() but I am not sure how to pass this message builder into it.
2 way bot what? Direct Message? Reply? latest version allows you to use $message->reply()
with message builder, try to update your DiscordPHP, if you haven't then add:
$builder->setReplyTo($message);
I went to update DiscordPHP but im using dev-master and it says its all up to date. However, when I use embed function it crashes so something seems off
show me your composer.json please
show me your composer.json please
{ "require": { "team-reflex/discord-php": "dev-master" } }
do you have
use Discord\Parts\Embed\Embed;
use Discord\Builders\MessageBuilder;
on top of your script?
do you have
use Discord\Parts\Embed\Embed; use Discord\Builders\MessageBuilder;
on top of your script?
edit: thank you! that fixed everything except for the line:
$channel->sendMessage($builder);
from there I added in the channel object
thanks again!
well, how did you obtain $channel ?
For the life of me I can't figure out how to create a formatted message similar to this:
message using message builder
` foreach ($result->asset_events as $asset) {
`
May I please ask a huge favor - Can someone please show me how to use Message Builder to construct a response with the code above that is similar to the attached picture?
Been pulling my hair out trying to figure this out
Thank you for the help !!!!