All Projects → discord-php → Discordphp

discord-php / Discordphp

Licence: mit
An API to interact with the popular messaging app Discord

Labels

Projects that are alternatives of or similar to Discordphp

Notsobot
NotSoSuper's Discord Bot
Stars: ✭ 305 (-25.43%)
Mutual labels:  discord
Discordia
Discord API library written in Lua for the Luvit runtime environment
Stars: ✭ 340 (-16.87%)
Mutual labels:  discord
Discord Term
Extensible Discord terminal client
Stars: ✭ 371 (-9.29%)
Mutual labels:  discord
Discord bot.py
🍺 A simple discord bot that helps you getting started within discord.py
Stars: ✭ 313 (-23.47%)
Mutual labels:  discord
Guidebot
A boilerplate example bot with command handler and reloadable commands. Updated and Maintained by the Idiot's Guide Community
Stars: ✭ 340 (-16.87%)
Mutual labels:  discord
Modmailbot
Modmail Bot is a bot for Discord that makes it easier for users to contact moderators and admins for help.
Stars: ✭ 354 (-13.45%)
Mutual labels:  discord
Xiao
Xiao is a Discord bot coded in JavaScript with discord.js using the Commando command framework. With over 500 commands, she is one of the most feature-rich bots out there. Formerly XiaoBot.
Stars: ✭ 302 (-26.16%)
Mutual labels:  discord
Easyrp
Give yourself a Custom Rich Presence in Discord.
Stars: ✭ 403 (-1.47%)
Mutual labels:  discord
Miranda Ng
Miranda NG: Next Generation of Miranda IM
Stars: ✭ 341 (-16.63%)
Mutual labels:  discord
Lightcord
A simple - customizable - Discord Client
Stars: ✭ 366 (-10.51%)
Mutual labels:  discord
Sample Programs
Sample Programs in Every Programming Language
Stars: ✭ 323 (-21.03%)
Mutual labels:  discord
Oauth
🔗 OAuth 2.0 implementation for various providers in one place.
Stars: ✭ 336 (-17.85%)
Mutual labels:  discord
Unifiedmessagerelay
Group Message Forward Framework (supports QQ Telegram Line Discord)
Stars: ✭ 363 (-11.25%)
Mutual labels:  discord
Betterdiscordaddons
A series of plugins and themes for BetterDiscord.
Stars: ✭ 310 (-24.21%)
Mutual labels:  discord
Matrix Appservice Discord
A bridge between Matrix and Discord.
Stars: ✭ 383 (-6.36%)
Mutual labels:  discord
Embed Visualizer
discord embed visualization tool
Stars: ✭ 306 (-25.18%)
Mutual labels:  discord
Gef
GEF (GDB Enhanced Features) - a modern experience for GDB with advanced debugging features for exploit developers & reverse engineers ☢
Stars: ✭ 4,197 (+926.16%)
Mutual labels:  discord
Messenger Ios Chat Swift Firestore
Messenger Clone - Real-time iOS Chat with Firebase Firestore written in Swift
Stars: ✭ 405 (-0.98%)
Mutual labels:  discord
Matterbridge
bridge between mattermost, IRC, gitter, xmpp, slack, discord, telegram, rocketchat, twitch, ssh-chat, zulip, whatsapp, keybase, matrix, microsoft teams, nextcloud, mumble, vk and more with REST API (mattermost not required!)
Stars: ✭ 4,452 (+988.51%)
Mutual labels:  discord
Javacord
An easy to use multithreaded library for creating Discord bots in Java.
Stars: ✭ 368 (-10.02%)
Mutual labels:  discord

DiscordPHP

PHP Discorders

A wrapper for the official Discord REST, gateway and voice APIs. Documentation is available here, albeit limited at the moment, as well as a class reference. Feel free to ask questions in the Discord server above.

For testing and stability it would be greatly appreciated if you were able to add our test bot to your server. We don't store any data - the bot simply idles and does not interact with anyone and is used to test stability with large numbers of guilds. You can invite the bot here.

This library does not handle slash commands. See DiscordPHP-Slash for a library to handle these interactions.

Before you start

Before you start using this Library, you need to know how PHP works, you need to know the language and you need to know how Event Loops and Promises work. This is a fundamental requirement before you start. Without this knowledge, you will only suffer.

FAQ

  1. Can I run DiscordPHP on a webserver (e.g. Apache, nginx)?
    • No, DiscordPHP will only run in CLI. If you want to have an interface for your bot you can integrate react/http with your bot and run it through CLI.
  2. PHP is running out of memory?
    • Try increase your memory limit using ini_set('memory_limit', '-1');.

Getting Started

Requirements

  • PHP 7.3
    • Technically the library can run on some versions of PHP 7.2, however, no support will be given for any version lower than 7.3.
    • The requirement will be increased to PHP 7.4 so you should develop for the latest version of PHP.
  • Composer
  • ext-json
  • ext-zlib

Windows and SSL

Unfortunately PHP on Windows does not have access to the Windows Certificate Store. This is an issue because TLS gets used and as such certificate verification gets applied (turning this off is not an option).

You will notice this issue by your script exiting immediately after one loop turn without any errors. Unfortunately there is for some reason no error or exception.

As such users of this library need to download a Certificate Authority extract from the cURL website.
The path to the caextract must be set in the php.ini for openssl.cafile.

Recommended Extensions

  • The latest PHP version.
  • One of ext-uv (preferred), ext-libev or evt-event for a faster, and more performant event loop.
  • ext-mbstring if handling non-english characters.

Voice Requirements

  • 64-bit Linux or Darwin based OS. Voice does not run on Windows.
  • ext-sodium
  • FFmpeg

Installing DiscordPHP

DiscordPHP is installed using Composer.

  1. Run composer require team-reflex/discord-php. This will install the lastest release.
    • If you would like, you can also install the development branch by running composer require team-reflex/discord-php dev-master.
  2. Include the Composer autoload file at the top of your main file:
    • include __DIR__.'/vendor/autoload.php';
  3. Make a bot!

Basic Example

<?php

include __DIR__.'/vendor/autoload.php';

use Discord\Discord;

$discord = new Discord([
	'token' => 'bot-token',
]);

$discord->on('ready', function ($discord) {
	echo "Bot is ready!", PHP_EOL;

	// Listen for messages.
	$discord->on('message', function ($message, $discord) {
		echo "{$message->author->username}: {$message->content}",PHP_EOL;
	});
});

$discord->run();

Documentation

Documentation can be found here. Raw documentation can be found in-line in the code and on the DiscordPHP Class Reference.

Contributing

We are open to contributions. However, please make sure you follow our coding standards (PSR-4 autoloading and custom styling). Please run php-cs-fixer before opening a pull request by running composer run-script cs.

License

MIT License, © David Cole and other contributers 2016-present.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].