Skip to content

Commit

Permalink
php-cs-fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
valzargaming committed Dec 6, 2020
1 parent df4fa62 commit 5cc569a
Show file tree
Hide file tree
Showing 35 changed files with 7,748 additions and 6,813 deletions.
1 change: 1 addition & 0 deletions .php_cs.cache

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion CHANGEME.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@
$creator_discriminator = "5947";
$creator_id = "116927250145869826";
$creator_check = "$creator_name#$creator_discriminator";
?>
178 changes: 90 additions & 88 deletions author_perms.php
Original file line number Diff line number Diff line change
@@ -1,92 +1,94 @@
<?php
$author = $message->author; //Member OR User object
if (get_class($author) == "Discord\Parts\User\Member"){
$author_user = $author->user;
$author_member = $author;
}else $author_user = $author;
if($author_member){
//Permissions granted by roles
$user_perms = Array(
'priority_speaker' => false,
'stream' => false,
'connect' => false,
'speak' => false,
'mute_members' => false,
'deafen_members' => false,
'move_members' => false,
'use_vad' => false,

'add_reactions' => false,
'send_messages' => false,
'send_tts_messages' => false,
'manage_messages' => false,
'embed_links' => false,
'attach_files' => false,
'read_message_history' => false,
'mention_everyone' => false,
'use_external_emojis' => false,

'kick_members' => false,
'ban_members' => false,
'administrator' => false,
'manage_guild' => false,
'view_audit_log' => false,
'view_guild_insights' => false,
'change_nickname' => false,
'manage_nicknames' => false,
'manage_emojis' => false,

'bitwise' => 0,
'create_instant_invite' => false,
'manage_channels' => false,
'view_channel' => false,
'manage_roles' => false,
'manage_webhooks' => false
);

$author_member_roles = $author_member->roles; //Role objects for the author);

foreach ($author_member_roles as $role){ //Check all roles for guild and channel permissions
$permissions = json_decode(json_encode($role->permissions), 1);
foreach ($permissions as $id => $perm) {
if ($perm === true) $user_perms[$id] = true;
//echo "id: " . $id . PHP_EOL;
//echo "perm: $perm" . PHP_EOL;
}
/*
if ($permissions->priority_speaker === true) $priority_speaker = true;
if ($permissions->stream === true) $stream = true;
if ($permissions->connect === true) $connect = true;
if ($permissions->speak === true) $speak = true;
if ($permissions->mute_members === true) $mute_members = true;
if ($permissions->deafen_members === true) $deafen_members = true;
if ($permissions->move_members === true) $move_members = true;
if ($permissions->use_vad === true) $use_vad = true;
if ($permissions->add_reactions === true) $add_reactions = true;
if ($permissions->send_messages === true) $send_messages = true;
if ($permissions->send_tts_messages === true) $send_tts_messages = true;
if ($permissions->manage_messages === true) $manage_messages = true;
if ($permissions->embed_links === true) $embed_links = true;
if ($permissions->attach_files === true) $attach_files = true;
if ($permissions->read_message_history === true) $read_message_history = true;
if ($permissions->mention_everyone === true) $mention_everyone = true;
if ($permissions->use_external_emojis === true) $use_external_emojis = true;
if (get_class($author) == "Discord\Parts\User\Member") {
$author_user = $author->user;
$author_member = $author;
} else {
$author_user = $author;
}
if ($author_member) {
//Permissions granted by roles
$user_perms = array(
'priority_speaker' => false,
'stream' => false,
'connect' => false,
'speak' => false,
'mute_members' => false,
'deafen_members' => false,
'move_members' => false,
'use_vad' => false,

'add_reactions' => false,
'send_messages' => false,
'send_tts_messages' => false,
'manage_messages' => false,
'embed_links' => false,
'attach_files' => false,
'read_message_history' => false,
'mention_everyone' => false,
'use_external_emojis' => false,

'kick_members' => false,
'ban_members' => false,
'administrator' => false,
'manage_guild' => false,
'view_audit_log' => false,
'view_guild_insights' => false,
'change_nickname' => false,
'manage_nicknames' => false,
'manage_emojis' => false,

'bitwise' => 0,
'create_instant_invite' => false,
'manage_channels' => false,
'view_channel' => false,
'manage_roles' => false,
'manage_webhooks' => false
);

$author_member_roles = $author_member->roles; //Role objects for the author);

foreach ($author_member_roles as $role) { //Check all roles for guild and channel permissions
$permissions = json_decode(json_encode($role->permissions), 1);
foreach ($permissions as $id => $perm) {
if ($perm === true) {
$user_perms[$id] = true;
}
//echo "id: " . $id . PHP_EOL;
//echo "perm: $perm" . PHP_EOL;
}
/*
if ($permissions->priority_speaker === true) $priority_speaker = true;
if ($permissions->stream === true) $stream = true;
if ($permissions->connect === true) $connect = true;
if ($permissions->speak === true) $speak = true;
if ($permissions->mute_members === true) $mute_members = true;
if ($permissions->deafen_members === true) $deafen_members = true;
if ($permissions->move_members === true) $move_members = true;
if ($permissions->use_vad === true) $use_vad = true;
if ($permissions->add_reactions === true) $add_reactions = true;
if ($permissions->send_messages === true) $send_messages = true;
if ($permissions->send_tts_messages === true) $send_tts_messages = true;
if ($permissions->manage_messages === true) $manage_messages = true;
if ($permissions->embed_links === true) $embed_links = true;
if ($permissions->attach_files === true) $attach_files = true;
if ($permissions->read_message_history === true) $read_message_history = true;
if ($permissions->mention_everyone === true) $mention_everyone = true;
if ($permissions->use_external_emojis === true) $use_external_emojis = true;
if ($permissions->kick_members === true) $kick_members = true;
if ($permissions->ban_members === true) $ban_members = true;
if ($permissions->administrator === true) $administrator = true;
if ($permissions->manage_guild === true) $manage_guild = true;
if ($permissions->view_audit_log === true) $view_audit_log = true;
if ($permissions->view_guild_insights === true) $view_guild_insights = true;
if ($permissions->change_nickname === true) $change_nickname = true;
if ($permissions->manage_nicknames === true) $manage_nicknames = true;
if ($permissions->manage_emojis === true) $manage_emojis = true;
*/
}
//echo "kick_members: " . $user_perms['kick_members'] . PHP_EOL;
//var_dump($user_perms);
//var_dump($author_member->getPermissions());

if ($permissions->kick_members === true) $kick_members = true;
if ($permissions->ban_members === true) $ban_members = true;
if ($permissions->administrator === true) $administrator = true;
if ($permissions->manage_guild === true) $manage_guild = true;
if ($permissions->view_audit_log === true) $view_audit_log = true;
if ($permissions->view_guild_insights === true) $view_guild_insights = true;
if ($permissions->change_nickname === true) $change_nickname = true;
if ($permissions->manage_nicknames === true) $manage_nicknames = true;
if ($permissions->manage_emojis === true) $manage_emojis = true;
*/
}
//echo "kick_members: " . $user_perms['kick_members'] . PHP_EOL;
//var_dump($user_perms);
//var_dump($author_member->getPermissions());
}
?>
1 change: 0 additions & 1 deletion blacklisted_guilds.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?php
$blacklisted_guilds[] = "581914082471444511";
$blacklisted_guilds[] = "697833083201650689";
?>
1 change: 0 additions & 1 deletion blacklisted_owners.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@
$blacklisted_owners[] = "218798013630513152";
$blacklisted_owners[] = "303573625674399754";
$blacklisted_owners[] = "149195023265562624";
?>
1 change: 0 additions & 1 deletion config.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,3 @@
$sexuality_option = false;
$gender_option = false;
$custom_option = false; //Edit custom_roles.php before changing this to true!
?>
1 change: 0 additions & 1 deletion constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
$BASE_DIR = __DIR__ . "/../";
$DIR = __DIR__ . "\\";
$now = new DateTime();
?>
Loading

0 comments on commit 5cc569a

Please sign in to comment.