void HandleDiscordMessage(RelayBot bot, string channel, RelayUser p, string message, ref bool cancel) { if (bot != DiscordPlugin.Bot) { return; // Don't want it enabled for IRC } if (!message.StartsWith(".verify ")) { return; } Player[] players = PlayerInfo.Online.Items; foreach (Player pl in players) { if (pl.Extras.GetString("DISCORD_VERIFICATION_CODE") == message.Split(' ')[1]) { string data = verified.FindData(pl.truename); if (data == null) { // Give verified role on Discord if (giveRole) { DiscordApiMessage msg = new AddGuildMemberRole(serverID, p.ID, roleID); DiscordPlugin.Bot.Send(msg); } // Change nickname on Discord // NOTE: Does not work on the guild's owner. See: https://github.com/discord/discord-api-docs/issues/2139 if (changeNick) { DiscordApiMessage msg = new ChangeNick(serverID, p.ID, pl.name); DiscordPlugin.Bot.Send(msg); } verified.Update(pl.truename, p.ID); verified.Save(); pl.Extras.Remove("DISCORD_VERIFICATION_CODE"); pl.Message("%aAccount successfully linked with ID %b" + p.ID + "%a."); } } } cancel = true; }
void HandlePlayerConnect(Player p) { string date = DateTime.UtcNow.ToShortDateString(); string lastDate = dailyList.FindData(p.name); if (lastDate == null || lastDate != date) // Check if they've already claimed their bonus // Add the player's current date to the list { dailyList.AddOrReplace(p.name, date); dailyList.Save(); p.Message("%SYou claimed your daily bonus of &b" + amount + " %S" + Server.Config.Currency + "%S."); p.SetMoney(p.money + amount); } if (lastDate == date) { p.Message("%cYou have already claimed your daily bonus for today."); } }
public static void AddTeam(string name, string color, string skinUrl) { Teams.AddOrReplace(name, color + " " + skinUrl); Teams.Save(); }