-
-
Notifications
You must be signed in to change notification settings - Fork 251
Closed
Description
$message->author
Is null
$discord->on('message', function ($message, $discord) {
$discord_full_id = "{$message->author->user}";
$discord_id = str_replace(">", "", str_replace("<@", "", $discord_full_id));
$guild_id = $message->channel->guild_id;
$channel_id = $message->channel_id;
$guild = $discord->guilds->get('id', $guild_id);
$botuser = $guild->members->get('id', 722051357783228498 );
$channel = $guild->channels->get('id', $channel_id);
if ($message->author == $botuser) {
return;
}
msg($message);
if (fnmatch('!*', $message->content)) {
$message->channel->messages->delete($message);
}
});
});
function msg($msg) {
echo var_dump($msg->author); // [ THIS ]
}This is My code
"[ THIS ]" Returns "NULL"
Why?
I got a null->user->... error.
BotUser code successfully blocks bot-executing commands (I got a very big bug that bot executes same cmd, loop)
I'm both NewBie of English, DiscordPHP, PHP Object.
Pls execute it, and read.
++ How to get user by Mention?
EX)
!dmbot @minco#0000
How to make bot DM to @minco#0000 when I execute this cmd?
(Do not care about , Just for no-GitHub-mention)
Metadata
Metadata
Assignees
Labels
No labels