All Projects → JABirchall → botman-driver-discord

JABirchall / botman-driver-discord

Licence: LGPL-3.0 License
A discord driver for Botman utilising Yasmin

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to botman-driver-discord

idea
Gestor de actividades en grupo
Stars: ✭ 16 (+14.29%)
Mutual labels:  botman
Botman
A framework agnostic PHP library to build chat bots
Stars: ✭ 5,538 (+39457.14%)
Mutual labels:  botman

botman-driver-discord

Getting Started

Require the driver into your botman project composer require jabirchall/botman-driver-discord

Example

$config = [
    'discord' =>[
        'token' => "your token",
        'options' => [
            'disableClones' => true,
            'disableEveryone' => true,
            'fetchAllMembers' => false,
            'messageCache' => true,
            'messageCacheLifetime' => 600,
            'messageSweepInterval' => 600,
            'presenceCache' => false,
            'userSweepInterval' => 600,
            'ws.disabledEvents' => [],
        ],
    ],
];

// Load the driver(s) you want to use
DriverManager::loadDriver(\JABirchall\BotMan\Drivers\Discord\DiscordDriver::class);
$loop = Factory::create();
$botman = BotManFactory::createForDiscord($config, $loop);

// Give the bot something to listen for.
$botman->hears('hello', function (BotMan $bot) {
    $bot->reply('Hello yourself.');
});

// start a convosation
$botman->hears('How are you', function (BotMan $bot) {
    $bot->ask("I'm a bot I have no feelings, How about you?", function (Answer $answer) use ($bot) {
        $bot->reply("Thats great, you said: ". $answer->getText());
    });
});

// Start listening
$botman->listen();
$loop->run();

Prerequisities

  • Botman 2.*
  • PHP version 7.1+
  • mbstring
  • A discord bot token

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Authors

  • JABirchall - Maintainer

See also the list of contributors who participated in this project.

License

This project is licensed under GNU AGPLv3 License - see the LICENSE file for details

Acknowledgments

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].