PHPackages                             crownrp/laravel-discord-bot - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. crownrp/laravel-discord-bot

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

crownrp/laravel-discord-bot
===========================

A robust Discord messaging integration for Laravel with support for adding roles

v1.0.8(2y ago)127MITPHPPHP &gt;=7.4

Since May 16Pushed 2y agoCompare

[ Source](https://github.com/CrownRP/laravel-discord-bot)[ Packagist](https://packagist.org/packages/crownrp/laravel-discord-bot)[ RSS](/packages/crownrp-laravel-discord-bot/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelog (8)Dependencies (4)Versions (9)Used By (0)

Laravel Discord Bot
===================

[](#laravel-discord-bot)

A robust Discord messaging integration for Laravel Extended with features to manage guild roles

---

### About

[](#about)

This package provides a notification channel to send messages to Discord, as well as a suite of tools, services, and components that will help you to build rich-text messages as well as handle [Discord Interactions](https://discord.com/developers/docs/interactions/receiving-and-responding).

---

Installation
============

[](#installation)

### Pre Requisites

[](#pre-requisites)

1. Laravel v8+
2. PHP 7.4+
3. [libsodium](https://doc.libsodium.org/bindings_for_other_languages#programming-languages-whose-standard-library-includes-support-for-libsodium)

### Install with Composer

[](#install-with-composer)

```
composer require crownrp/laravel-discord-bot

```

### Configuration

[](#configuration)

1. Visit the [Discord Developer Portal](https://discord.com/developers/applications) and create a new Application
2. Copy the Application ID and the Public Key
3. Create a Bot User
4. Reset the Bot User Token and copy it

Populate your `.env`:

```
DISCORD_API_BOT_TOKEN=
DISCORD_APPLICATION_ID=
DISCORD_PUBLIC_KEY=

```

#### Additional Configuration (optional)

[](#additional-configuration-optional)

When handling interactions the default response behavior is to "defer" - aka stop the loading process in the Discord app window and return no reply or other message. If you'd like to change this to "load" - which will show a loading message until your application sends a followup message - add the following to your `.env`:

```
DISCORD_COMPONENT_INTERACTION_DEFAULT_BEHAVIOR=load

```

Notification Channel Usage
==========================

[](#notification-channel-usage)

Your notification class must implement the interface `Nwilging\LaravelDiscordBot\Contracts\Notifications\DiscordNotificationContract`, and include the `toDiscord(): array`method.

#### Example with Plain Text message

[](#example-with-plain-text-message)

```
