Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
braindigitalis committed Sep 7, 2024
0 parents commit 1f9854c
Show file tree
Hide file tree
Showing 1,843 changed files with 173,453 additions and 0 deletions.
59 changes: 59 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost

LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=

BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

MEMCACHED_HOST=127.0.0.1

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=smtp
MAIL_HOST=mailpit
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_HOST=
PUSHER_PORT=443
PUSHER_SCHEME=https
PUSHER_APP_CLUSTER=mt1

VITE_APP_NAME="${APP_NAME}"
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_HOST="${PUSHER_HOST}"
VITE_PUSHER_PORT="${PUSHER_PORT}"
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/.phpunit.cache
/node_modules
/public/build
/public/hot
/public/storage
/storage/*.key
/vendor
.env
.env.backup
.env.production
.phpunit.result.cache
Homestead.json
Homestead.yaml
auth.json
npm-debug.log
yarn-error.log
/.fleet
/.idea
/.vscode

# Sentry Config File
.env.sentry-build-plugin

# Sentry Config File
.env.sentry-build-plugin
26 changes: 26 additions & 0 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
/**
* Define the application's command schedule.
*/
protected function schedule(Schedule $schedule): void
{
}

/**
* Register the commands for the application.
*/
protected function commands(): void
{
$this->load(__DIR__.'/Commands');

require base_path('routes/console.php');
}
}
49 changes: 49 additions & 0 deletions app/Enums/DiscordPermissionsEnum.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

namespace App\Enums;

use Jakyeru\Larascord\Types\Guild;

enum DiscordPermissionsEnum: int
{
case CREATE_INSTANT_INVITE = 0x00000001;
case KICK_MEMBERS = 0x00000002;
case BAN_MEMBERS = 0x00000004;
case ADMINISTRATOR = 0x00000008;
case MANAGE_CHANNELS = 0x00000010;
case MANAGE_GUILD = 0x00000020;
case ADD_REACTIONS = 0x00000040;
case VIEW_AUDIT_LOG = 0x00000080;
case VIEW_CHANNEL = 0x00000400;
case SEND_MESSAGES = 0x00000800;
case SEND_TTS_MESSAGES = 0x00001000;
case MANAGE_MESSAGES= 0x00002000;
case EMBED_LINKS = 0x00004000;
case ATTACH_FILES = 0x00008000;
case READ_MESSAGE_HISTORY = 0x00010000;
case MENTION_EVERYONE = 0x00020000;
case USE_EXTERNAL_EMOJIS = 0x00040000;
case CONNECT = 0x00100000;
case SPEAK = 0x00200000;
case MUTE_MEMBERS = 0x00400000;
case DEAFEN_MEMBERS = 0x00800000;
case MOVE_MEMBERS = 0x01000000;
case USE_VAD = 0x02000000;
case PRIORITY_SPEAKER = 0x00000100;
case STREAM = 0x00000200;
case CHANGE_NICKNAME = 0x04000000;
case MANAGE_NICKNAMES = 0x08000000;
case MANAGE_ROLES = 0x10000000;
case MANAGE_WEBHOOKS = 0x20000000;
case MANAGE_EMOJIS = 0x40000000;

/**
* Returns true if the guild permissions contain the given permission
* @param Guild $guild Guild to check
* @param DiscordPermissionsEnum $permission Permission to check
* @return bool True if the guild contains the permission
*/
static public function hasPermission(Guild $guild, DiscordPermissionsEnum $permission): bool {
return ($guild->permissions_new & $permission->value);
}
};
13 changes: 13 additions & 0 deletions app/Enums/PlayerProfessionEnum.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace App\Enums;

enum PlayerProfessionEnum: int
{
case Warrior = 1;
case Wizard = 2;
case Thief = 3;
case Woodsman = 4;
case Assassin = 5;
case Mercenary = 6;
}
15 changes: 15 additions & 0 deletions app/Enums/PlayerRaceEnum.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace App\Enums;

enum PlayerRaceEnum: int
{
case Human = 1;
case Elf = 2;
case Orc = 3;
case Dwarf = 4;
case LesserOrc = 5;
case Barbarian = 6;
case Goblin = 7;
case DarkElf = 8;
}
32 changes: 32 additions & 0 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

namespace App\Exceptions;

use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;

class Handler extends ExceptionHandler
{
/**
* The list of the inputs that are never flashed to the session on validation exceptions.
*
* @var array<int, string>
*/
protected $dontFlash = [
'current_password',
'password',
'password_confirmation',
];

/**
* Register the exception handling callbacks for the application.
*/
public function register(): void
{
$this->reportable(function (Throwable $e) {
if (app()->bound('sentry')) {
app('sentry')->captureException($e);
}
});
}
}
9 changes: 9 additions & 0 deletions app/Exceptions/LoginException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace App\Exceptions;

use RuntimeException;

class LoginException extends RuntimeException
{
}
95 changes: 95 additions & 0 deletions app/Helpers/botApiRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<?php

if (!function_exists("botApiRequest")) {

/**
* Call the Discord API as the bot using the bots token
*
* @param string $url API URL to request from
* @param string $requestType Request type
* @param string|null $post POST data, or NULL if no POST data
* @param array $headers optional additional headers to send
* @param array $files Array of MIME multipart files to upload with the request
* @return object|array|null API result
*/
function botApiRequest(string $url, string $requestType = 'GET', ?string $post = null, array $headers = [], array $files = []): object|array|null
{
$ch = curl_init('https://discord.com/api/' . $url);

curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $requestType);
curl_setopt($ch, CURLOPT_HEADER, 1);

$data = '';

if (!empty($files)) {
$boundary = uniqid();
$delimiter = '-------------' . $boundary;

$data .= "--" . $delimiter . "\r\n"
. 'Content-Disposition: form-data; name="payload_json"' . "\r\nContent-Type: application/json\r\n\r\n"
. $post . "\r\n";

foreach ($files as $name => $content) {
$data .= "--" . $delimiter . "\r\nContent-Transfer-Encoding: base64\r\n"
. 'Content-Disposition: form-data; name="' . $name . '"; filename="' . $name . '"' . "\r\n\r\n"
. base64_encode($content) . "\r\n";
}

$data .= "--" . $delimiter . "--\r\n";
$headers[] = 'Content-Type: multipart/form-data; boundary=' . $delimiter;
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $data
]);
} else {
if (!empty($post)) {
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $post
]);
}
$headers[] = 'Content-Type: application/json';
}

$headers[] = 'Accept: application/json';
$headers[] = 'Authorization: Bot ' . env("BOT_TOKEN");
$headers[] = 'Content-Length: ' . !empty($post) ? strlen($post) : 0;
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$response = curl_exec($ch);

$r_headers = [];
$r_header_text = substr($response, 0, strpos($response, "\r\n\r\n"));
foreach (explode("\r\n", $r_header_text) as $i => $line) {
if ($i === 0) {
$r_headers['http_code'] = $line;

} else {
list($k, $v) = explode(': ', $line, 2);
$r_headers[$k] = $v;
}
}

/* Large POSTS create this extra status code, ick */
while (str_starts_with($response, "HTTP/1.1 100 Continue\r\n\r\n")) {
$response = substr($response, 25, strlen($response));
}

$header_end = strpos($response, "\r\n\r\n") + 4;
$response = substr($response, $header_end, strlen($response));

if (isset($r_headers['x-ratelimit-remaining']) && $r_headers['x-ratelimit-remaining'] == 0) {
/* Sleep and wait until we can send again */
$now = time() - date('Z');
$later = $r_headers['x-ratelimit-reset'] - date('Z');
$seconds = $later - $now + 1;
if ($seconds > 0 && PHP_SAPI === 'cli') {
sleep($seconds);
}
}

return json_decode($response);
}
}
17 changes: 17 additions & 0 deletions app/Helpers/salutation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

if (!function_exists("salutation")) {

function salutation(): string
{
$time = date("H");
if ($time < 12) {
return "morning";
} else if ($time < 18) {
return "afternoon";
} else {
return "evening";
}
}

}
17 changes: 17 additions & 0 deletions app/Http/Controllers/Auth/AuthenticatedSessionController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;

class AuthenticatedSessionController extends Controller
{
public function destroy(Request $request): RedirectResponse
{
Auth::logout();
return redirect('/');
}
}
11 changes: 11 additions & 0 deletions app/Http/Controllers/Auth/ConfirmablePasswordController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace App\Http\Controllers\Auth;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;

class ConfirmablePasswordController extends Controller
{
//
}
Loading

0 comments on commit 1f9854c

Please sign in to comment.