xabbo-scripts/Scripts/habbo to discord.csx
Administrator 7a548130a3 Move all scripts into Scripts/ subfolder
Keeps the repo root clean - only README.md visible on landing page.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 09:49:37 +01:00

27 lines
1.3 KiB
C#

using System.Net.Http;
using System.Text.Json;
const string
WebhookUrl = "discord_webhook_url",
BaseHotel = "habbo.com";
async Task logdiscord(string username, string message) {
using(var http = new HttpClient()) {
string avatarUrl = $"https://www.{BaseHotel}/habbo-imaging/avatarimage?img_format=png&user={username}&direction=2&head_direction=2&size=l";
var payload = new {username = username,avatar_url = avatarUrl,content = message};
await http.PostAsync(WebhookUrl,new StringContent(JsonSerializer.Serialize(payload),Encoding.UTF8, "application/json"));}}
OnChat(async e => {
if (e.ChatType == ChatType.Talk) {await logdiscord(e.Entity.Name, e.Message);}});
OnChat(async e => {
if (e.ChatType == ChatType.Shout) {await logdiscord(e.Entity.Name, $"**{e.Message}**");}});
OnEntityAction(async e => {
if (e.Action == Actions.Idle) {await logdiscord(e.Entity.Name, "`Is now Afk`");}});
OnEntityUpdated(async e => {
if (e.Entity.CurrentUpdate.SittingOnFloor) {await
logdiscord(e.Entity.Name, $"Is now sitting at location {e.Entity.Location.XY}");}});
OnEntityRemoved(e => logdiscord(e.Entity.Name, "`Left the Room`"));
OnEntityAdded(e => logdiscord(e.Entity.Name, "`Joined the Room`"));
OnEntityDance(e => logdiscord(e.Entity.Name, "`Is Dancing`"));
Wait();