Skip to content

Commit 939b907

Browse files
committed
Update | Beta 5.1.7
1 parent 8d35dde commit 939b907

File tree

5 files changed

+170
-93
lines changed

5 files changed

+170
-93
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "The Ourted library provides a discord bot process written in PHP.",
44
"type": "library",
55
"require": {
6-
"php": "7.*",
6+
"php": ">=7.2.0",
77
"ratchet/pawl": "*",
88
"vlucas/phpdotenv": "*",
99
"ext-json": "*",

composer.lock

Lines changed: 65 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Bot.php

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,6 @@
2020
class Bot
2121
{
2222

23-
static $GUILD_TEXT = 0;
24-
static $DM = 1;
25-
static $GUILD_VOICE = 2;
26-
static $GROUP_DM = 3;
27-
static $GUILD_NEWS = 4;
28-
static $GUILD_STORE = 5;
29-
30-
31-
32-
3323
/**
3424
* State
3525
* @var State
@@ -77,6 +67,11 @@ class Bot
7767
*/
7868
protected $connection;
7969

70+
/**
71+
* @var bool
72+
*/
73+
protected $reconnect = false;
74+
8075

8176
/* Classes */
8277
/**
@@ -137,6 +132,7 @@ public function init()
137132
$connector($this->wssUrl)->then(function (WebSocket $conn) {
138133
$this->connection = $conn;
139134
$this->state = $state = new State($conn, $this->loop, $this->token);
135+
$this->state->send_log = $this->send_log;
140136
$state->addDispatch($this->dispatch);
141137

142138

@@ -147,8 +143,13 @@ public function init()
147143

148144

149145
$conn->on('close', function ($code = null, $reason = null) {
150-
echo "Connection closed ({$code} - {$reason})\n";
151-
die();
146+
echo "\nConnection closed ({$code} - {$reason})\n";
147+
if(!$this->reconnect) {
148+
die();
149+
}else{
150+
$this->stop();
151+
$this->run();
152+
}
152153
});
153154

154155

@@ -222,6 +223,7 @@ public function run()
222223
{
223224

224225
$this->loop->run();
226+
echo "Connection Started!";
225227
}
226228

227229
/**

src/Interfaces/Types.php

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
3+
namespace Ourted\Interfaces;
4+
5+
class Types
6+
{
7+
public function permissions()
8+
{
9+
static $CREATE_INSTANT_INVITE = 0x00000001;
10+
static $KICK_MEMBERS = 0x00000002;
11+
static $BAN_MEMBERS = 0x00000004;
12+
static $ADMINISTRATOR = 0x00000008;
13+
static $MANAGE_CHANNELS = 0x00000010;
14+
static $MANAGE_GUILD = 0x00000020;
15+
static $ADD_REACTIONS = 0x00000040;
16+
static $VIEW_AUDIT_LOG = 0x00000080;
17+
static $PRIORITY_SPEAKER = 0x00000100;
18+
static $STREAM = 0x00000200;
19+
static $VIEW_CHANNEL = 0x00000400;
20+
static $SEND_MESSAGES = 0x00000800;
21+
static $SEND_TTS_MESSAGES = 0x00001000;
22+
static $MANAGE_MESSAGES = 0x00002000;
23+
static $EMBED_LINKS = 0x00004000;
24+
static $ATTACH_FILES = 0x00008000;
25+
static $READ_MESSAGE_HISTORY = 0x00010000;
26+
static $MENTION_EVERYONE = 0x00020000;
27+
static $USE_EXTERNAL_EMOJIS = 0x00040000;
28+
static $VIEW_GUILD_INSIGHTS = 0x00080000;
29+
static $CONNECT = 0x00100000;
30+
static $SPEAK = 0x00200000;
31+
static $MUTE_MEMBERS = 0x00400000;
32+
static $DEAFEN_MEMBERS = 0x00800000;
33+
static $MOVE_MEMBERS = 0x01000000;
34+
static $USE_VAD = 0x02000000;
35+
static $CHANGE_NICKNAME = 0x04000000;
36+
static $MANAGE_NICKNAMES = 0x08000000;
37+
static $MANAGE_ROLES = 0x10000000;
38+
static $MANAGE_WEBHOOKS = 0x20000000;
39+
static $MANAGE_EMOJIS = 0x40000000;
40+
}
41+
42+
public function textChannel()
43+
{
44+
static $GUILD_TEXT = 0;
45+
static $DM = 1;
46+
static $GUILD_VOICE = 2;
47+
static $GROUP_DM = 3;
48+
static $GUILD_NEWS = 4;
49+
static $GUILD_STORE = 5;
50+
}
51+
52+
53+
54+
}

0 commit comments

Comments
 (0)