Skip to content

Commit

Permalink
initial port from Slackbot to Discord Connector
Browse files Browse the repository at this point in the history
  • Loading branch information
warlof committed May 27, 2018
1 parent 5196d37 commit a8905e2
Show file tree
Hide file tree
Showing 48 changed files with 3,499 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.idea/
vendor/
composer.lock
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
# seat-discord-bot
# Seat Discord Connector
A [SeAT](https://github.com/eveseat/seat) plugin which maintain user access on a Discord Guild based on defined pattern.

[![Latest Unstable Version](https://poser.pugx.org/warlof/seat-discord-connector/v/unstable)](https://packagist.org/packages/warlof/seat-discord-connector)
[![Latest Stable Version](https://poser.pugx.org/warlof/seat-discord-connector/v/stable)](https://packagist.org/packages/warlof/seat-discord-connector)
[![Build Status](https://img.shields.io/travis/warlof/seat-discord-connector.svg?style=flat-square)](https://travis-ci.org/warlof/seat-discord-connector)
[![Code Climate](https://img.shields.io/codeclimate/github/warlof/seat-discord-connector.svg?style=flat-square)](https://codeclimate.com/github/warlof/seat-discord-connector)
[![Coverage Status](https://img.shields.io/coveralls/warlof/seat-discord-connector.svg?style=flat-square)](https://coveralls.io/github/warlof/seat-discord-connector?branch=master)
[![License](https://img.shields.io/badge/license-GPLv3-blue.svg?style=flat-square)](https://raw.githubusercontent.com/warlof/seat-discord-connector/master/LICENSE)
31 changes: 31 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "warlof/seat-discord-connector",
"description": "A SeAT plugin which maintain user access on a Discord Guild based on defined pattern.",
"type": "seat-plugin",
"autoload": {
"psr-4": {
"Warlof\\Seat\\Connector\\Discord\\": "src/"
}
},
"require": {
"eveseat/eveapi": "^3.0",
"eveseat/web": "^3.0",
"erusev/parsedown": "^1.7",
"restcord/restcord": "^0.2"
},
"license": "GPL-3.0-or-later",
"authors": [
{
"name": "Warlof Tutsimo",
"email": "[email protected]"
}
],
"minimum-stability": "stable",
"extra": {
"laravel": {
"providers": [
"Warlof\\Seat\\Connector\\Discord\\DiscordConnectorServiceProvider"
]
}
}
}
41 changes: 41 additions & 0 deletions src/Commands/DiscordLogsClear.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php
/**
* This file is part of slackbot and provide user synchronization between both SeAT and a Slack Team
*
* Copyright (C) 2016, 2017, 2018 Loïc Leuilliot <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

namespace Warlof\Seat\Connector\Discord\Commands;

use Illuminate\Console\Command;
use Warlof\Seat\Connector\Discord\Models\DiscordLog;

class DiscordLogsClear extends Command
{
protected $signature = 'slack:logs:clear';

protected $description = 'Clearing slack logs';

public function __construct()
{
parent::__construct();
}

public function handle()
{
DiscordLog::truncate();
}
}
51 changes: 51 additions & 0 deletions src/Commands/DiscordRoleSync.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php
/**
* This file is part of slackbot and provide user synchronization between both SeAT and a Slack Team
*
* Copyright (C) 2016, 2017, 2018 Loïc Leuilliot <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

namespace Warlof\Seat\Connector\Discord\Commands;

use Illuminate\Console\Command;
use Warlof\Seat\Connector\Discord\Jobs\SyncRole;

class DiscordRoleSync extends Command
{

/**
* @var string
*/
protected $signature = 'discord:role:sync';

/**
* @var string
*/
protected $description = 'Fire a job which will attempt to pull roles static information from Discord Guild.';

/**
* Execute the console command.
*/
public function handle()
{

SyncRole::dispatch();

$this->info('A synchronization job has been queued in order to update discord roles.');

}

}
48 changes: 48 additions & 0 deletions src/Commands/DiscordUserSync.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php
/**
* This file is part of slackbot and provide user synchronization between both SeAT and a Slack Team
*
* Copyright (C) 2016, 2017, 2018 Loïc Leuilliot <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Warlof\Seat\Connector\Discord\Commands;

use Illuminate\Console\Command;
use Warlof\Seat\Connector\Discord\Jobs\SyncUser;

class DiscordUserSync extends Command
{

/**
* @var string
*/
protected $signature = 'discord:user:sync';

/**
* @var string
*/
protected $description = 'Fire a job which will attempt to bind unlinked SeAT user to Discord user.';

/**
* Execute the console command
*/
public function handle()
{
SyncUser::dispatch();

$this->info('A synchronization job has been queued in order to update discord/seat user relation.');
}

}
30 changes: 30 additions & 0 deletions src/Config/discord-connector.config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php
/**
* This file is part of slackbot and provide user synchronization between both SeAT and a Slack Team
*
* Copyright (C) 2016, 2017, 2018 Loïc Leuilliot <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

/*
* TODO: lazy coder, remember to edit this file before TAG ! DAMMIT !
*/
return [
'version' => '3.0.0-beta1',
'loggly' => [
'key' => 'b4aa3599-add7-4afc-aeb0-a9906b39f316',
'tag' => 'discord-connector',
],
];
28 changes: 28 additions & 0 deletions src/Config/discord-connector.permissions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php
/**
* This file is part of slackbot and provide user synchronization between both SeAT and a Slack Team
*
* Copyright (C) 2016, 2017, 2018 Loïc Leuilliot <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

return [
'discord-connector' => [
'view',
'create',
'security',
'setup',
],
];
56 changes: 56 additions & 0 deletions src/Config/package.sidebar.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php
/**
* This file is part of slackbot and provide user synchronization between both SeAT and a Slack Team
*
* Copyright (C) 2016, 2017, 2018 Loïc Leuilliot <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

return [
'discord-connector' => [
'name' => 'Discord Connector',
'icon' => 'fa-plug',
'route_segment' => 'discord-connector',
'entries' => [
[
'name' => 'Access Management',
'label' => 'web::seat.access',
'icon' => 'fa-shield',
'route' => 'discord-connector.list',
],
[
'name' => 'User Mapping',
'label' => 'discord-connector::seat.user_mapping',
'icon' => 'fa-exchange',
'route' => 'discord-connector.users'
],
[
'name' => 'Settings',
'label' => 'web::seat.configuration',
'icon' => 'fa-cogs',
'route' => 'discord-connector.configuration',
'permission' => 'discord-connector.setup'
],
[
'name' => 'Logs',
'label' => 'web::seat.log',
'plural' => true,
'icon' => 'fa-list',
'route' => 'discord-connector.logs'
],
],
'permission' => 'discord-connector.view'
],
];
Loading

0 comments on commit a8905e2

Please sign in to comment.