Skip to content

Commit

Permalink
Syntax formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
valzargaming committed Nov 12, 2022
1 parent 77c43d5 commit b7f81dc
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 76 deletions.
2 changes: 1 addition & 1 deletion civ13.php
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ public function checkByondAge(string $age, string $minimum_age): bool
*/
public function verifyProcess(string $ckey, string $discord_id): string
{
if ($this->verified->has($discord_id)) { $member = $this->discord->guilds->get('id', $this->civ13_guild_id)->members->get('id', $discord_id); if (!$member->roles->has($this->discord_config[$this->civ13_guild_id]['roles']['verified'])) $member->addRole($this->discord_config[$this->civ13_guild_id]['roles']['verified']); return 'You are already verified!';}
if ($this->verified->has($discord_id)) { $member = $this->discord->guilds->get('id', $this->civ13_guild_id)->members->get('id', $discord_id); if (! $member->roles->has($this->discord_config[$this->civ13_guild_id]['roles']['verified'])) $member->addRole($this->discord_config[$this->civ13_guild_id]['roles']['verified']); return 'You are already verified!';}
if ($this->verified->has($ckey)) return "`$ckey` is already verified!";
if (! $this->pending->get('discord', $discord_id)) {
if (! $page = $this->getByondPage($ckey)) return "Ckey `$ckey` does not exist!";
Expand Down
22 changes: 11 additions & 11 deletions old_bot.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ function () use ($file) {
$on_message = function ($message) use ($discord, $loop, $owner_id, $admiral, $captain, $knight, $veteran, $infantry, $insults_path, $nomads_discord2ooc, $tdm_discord2ooc, $nomads_discord2admin, $tdm_discord2admin, $nomads_discord2dm, $tdm_discord2dm, $nomads_discord2ban, $tdm_discord2ban, $nomads_discord2unban, $tdm_discord2unban, $nomads_whitelist, $tdm_whitelist, $nomads_bans, $tdm_bans, $nomads_updateserverabspaths, $nomads_serverdata, $nomads_dmb, $nomads_killsudos, $nomads_killciv13, $nomads_mapswap, $mapswap_tdm, $tdm_updateserverabspaths, $tdm_serverdata, $tdm_dmb, $tdm_killsudos, $tdm_killciv13, $nomads_ip, $nomads_port, $tdm_ip, $tdm_port, $command_symbol)
{
if ($message->guild->owner_id != $owner_id) return; //Only process commands from a guild that Taislin owns
if (!$command_symbol) $command_symbol = '!s';
if (! $command_symbol) $command_symbol = '!s';

$author_user = $message->author; //This will need to be updated in a future release of DiscordPHP
if ($author_member = $message->member) {
Expand Down Expand Up @@ -469,7 +469,7 @@ function () use ($file) {
fclose($whitelist2);
}

if (!$found) {
if (! $found) {
$found2 = false;
$whitelist1 = fopen($nomads_whitelist, "r") ?? NULL;
if ($whitelist1) {
Expand Down Expand Up @@ -801,23 +801,23 @@ function () use ($file) {
}
fclose($filecheck2);
}
if (!$found) return $message->channel->sendMessage("No bans were found for **$ckey**.");
if (! $found) return $message->channel->sendMessage("No bans were found for **$ckey**.");
} else return $message->channel->sendMessage("Wrong format. Please try '!s bancheck [ckey].'");
return;
}
if (str_starts_with($message_content_lower,'serverstatus')) { //See GitHub Issue #1
$embed = new \Discord\Parts\Embed\Embed($discord);
$_1714 = !portIsAvailable(1714);
$server_is_up = $_1714;
if (!$server_is_up) {
if (! $server_is_up) {
$embed->setColor(0x00ff00);
$embed->addFieldValues("TDM Server Status", "Offline");
#$message->channel->sendEmbed($embed);
#return;
} else {
$data = "None";
if ($_1714) {
if (!$data = file_get_contents($tdm_serverdata))
if (! $data = file_get_contents($tdm_serverdata))
return $message->channel->sendMessage("Unable to access `$tdm_serverdata`");
} else {
$embed->setColor(0x00ff00);
Expand Down Expand Up @@ -845,15 +845,15 @@ function () use ($file) {
}
$_1715 = !portIsAvailable(1715);
$server_is_up = ($_1715);
if (!$server_is_up) {
if (! $server_is_up) {
$embed->setColor(0x00ff00);
$embed->addFieldValues("Nomads Server Status", "Offline");
#$message->channel->sendEmbed($embed);
#return;
} else {
$data = "None";
if ($_1714) {
if (!$data = file_get_contents($nomads_serverdata))
if (! $data = file_get_contents($nomads_serverdata))
return $message->channel->sendMessage("Unable to access `$nomads_serverdata`");
} else {
$embed->setColor(0x00ff00);
Expand Down Expand Up @@ -942,7 +942,7 @@ function () use ($file) {
$on_message2 = function ($message) use ($discord, $loop, $recalculate_ranking, $owner_id, $ranking_path, $tdm_awards_path, $tdm_awards_br_path, $typespess_path, $typespess_launch_server_path, $command_symbol, $admiral)
{
if ($message->guild->owner_id != $owner_id) return; //Only process commands from a guild that Taislin owns
if (!$command_symbol) $command_symbol = '!s';
if (! $command_symbol) $command_symbol = '!s';

if (str_starts_with($message->content, $command_symbol . ' ')) { //Add these as slash commands?
$message_content = substr($message->content, strlen($command_symbol)+1);
Expand Down Expand Up @@ -999,7 +999,7 @@ function () use ($file) {
$result .= "**" . $sline[1] . "**" . " has a total rank of **" . $sline[0] . "**.";
};
}
if (!$found) return $message->channel->sendMessage("No medals found for this ckey.");
if (! $found) return $message->channel->sendMessage("No medals found for this ckey.");
return $message->channel->sendMessage($result);
}
if (str_starts_with($message_content_lower, 'medals')) {
Expand Down Expand Up @@ -1047,7 +1047,7 @@ function () use ($file) {
}
}
if ($result != '') return $message->channel->sendMessage($result);
if (!$found && ($result == '')) return $message->channel->sendMessage("No medals found for this ckey.");
if (! $found && ($result == '')) return $message->channel->sendMessage("No medals found for this ckey.");
}
if (str_starts_with($message_content_lower, 'brmedals')) {
$split_message = explode('brmedals ', $message_content);
Expand All @@ -1073,7 +1073,7 @@ function () use ($file) {
}
}
if ($result != '') return $message->channel->sendMessage($result);
if (!$found && ($result == '')) return $message->channel->sendMessage("No medals found for this ckey.");
if (! $found && ($result == '')) return $message->channel->sendMessage("No medals found for this ckey.");
}
if (str_starts_with($message_content_lower, 'ts')) {
$split_message = explode('ts ', $message_content);
Expand Down
Loading

0 comments on commit b7f81dc

Please sign in to comment.