Repository navigation
Expand file tree
/
Copy pathProgram.cs
More file actions
64 lines (54 loc) · 1.94 KB
/
Copy pathProgram.cs
File metadata and controls
64 lines (54 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
using Discord;
using Discord.WebSocket;
using System;
using System.Net.Sockets;
using System.Threading.Tasks;
class Program
{
private static DiscordSocketClient _client;
private static readonly string _serverIP = "99.93.7.39";
static async Task Main(string[] args)
{
Console.WriteLine("🚀 ARK Status Bot - FIXED INTENTS");
_client = new DiscordSocketClient(new DiscordSocketConfig
{
GatewayIntents = GatewayIntents.AllUnprivileged
| GatewayIntents.GuildMembers
| GatewayIntents.GuildPresences
| GatewayIntents.MessageContent // ← KLÍČOVÉ!
});
_client.Log += async (msg) =>
Console.WriteLine($"[{msg.Severity}] {msg.Message}");
_client.Ready += ClientReady;
_client.MessageReceived += HandleMessage;
await _client.LoginAsync(TokenType.Bot, "MTQ2ODIxMTkzMzM0NDk2MDY2OA.GVYTzp.IJWY3whfcM3DiXz4FspfMCA2ZVhj2Cp_n_ZT6k");
await _client.StartAsync();
await Task.Delay(-1);
}
static async Task ClientReady()
{
Console.WriteLine("✅ BOT READY!");
Console.WriteLine($"📡 {_client.Guilds.First().Name}");
}
static async Task HandleMessage(SocketMessage message)
{
if (message.Author.IsBot) return;
if (message.Content == "!status")
{
bool isOnline = PingServer(_serverIP, 7777);
await message.Channel.SendMessageAsync(
$"🦕 **ARK kluy13ix** | {(isOnline ? "🟢 ONLINE" : "🔴 OFFLINE")} | **99.93.7.39:7777**");
}
}
static bool PingServer(string ip, int port)
{
try
{
using var client = new TcpClient();
client.ReceiveTimeout = 3000;
client.Connect(ip, port);
return true;
}
catch { return false; }
}
}