本文整理汇总了C#中SteamKit2.SteamID.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# SteamID.ToString方法的具体用法?C# SteamID.ToString怎么用?C# SteamID.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SteamKit2.SteamID
的用法示例。
在下文中一共展示了SteamID.ToString方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: admincheck
///<summary> Checks if the given STEAMID is an admin in the database</summary>
public static bool admincheck(SteamID sender)
{
if (UserDatabase.ContainsKey(sender.ToString()))
{ //If the STEAMID is in the dictionary
string Key = sender.ToString();
EClanPermission UserPermissions = UserDatabase[Key]; //It will get the permissions value
if ((UserPermissions & EClanPermission.OwnerOfficerModerator) > 0) //Checks if it has sufficient privilages
{
return true; //If there's sufficient privilages, it'll return true
}
}
return false; //If there is no entry in the database, or there aren't sufficient privalages, it'll return false
}
示例2: checkAdmin
static public bool checkAdmin(SteamID sid)
{
if (admins.Contains(sid.ToString()))
return true;
else
steamFriends.SendChatMessage(sid, EChatEntryType.ChatMsg, "You cannot use this command because you're not an admin.");
return false;
}
示例3: DeclineGroupInvite
/// <summary>
/// Declines the invite to a Steam Group
/// </summary>
/// <param name="group">SteamID of the group to decline the invite from.</param>
private void DeclineGroupInvite(SteamID group)
{
var declineMsg = new ClientMsg<CMsgGroupInviteAction>((int)EMsg.ClientAcknowledgeClanInvite);
declineMsg.Body.GroupID = group.ConvertToUInt64();
declineMsg.Body.AcceptInvite = false;
SteamClient.Send(declineMsg);
Log.Info("Declined group invite to {0}.", group.ToString());
}
示例4: AcceptGroupInvite
/// <summary>
/// Accepts the invite to a Steam Group
/// </summary>
/// <param name="group">SteamID of the group to accept the invite from.</param>
private void AcceptGroupInvite(SteamID group)
{
var acceptMsg = new ClientMsg<CMsgGroupInviteAction>((int)EMsg.ClientAcknowledgeClanInvite);
acceptMsg.Body.GroupID = group.ConvertToUInt64();
acceptMsg.Body.AcceptInvite = true;
SteamClient.Send(acceptMsg);
Log.Success("Accepted group invite to {0}.", group.ToString());
}
示例5: InventoryFetchException
/// <summary>
/// Initializes a new instance of the <see cref="SteamTrade.Exceptions.InventoryFetchException"/> class.
/// </summary>
/// <param name='steamId'>
/// Steam identifier that caused the fetch exception.
/// </param>
public InventoryFetchException (SteamID steamId)
: base(String.Format("Failed to fetch inventory for: {0}", steamId.ToString()))
{
FailingSteamId = steamId;
}
示例6: Chatcommands
/// <summary>
/// The commands that users can use by msg'ing the system. Returns a string with the appropriate responses
/// </summary>
/// <param name="chatID">ChatID of the chatroom</param>
/// <param name="sender">STEAMID of the sender</param>
/// <param name="message">The message sent</param>
public static string Chatcommands(SteamID chatID, SteamID sender, string FullMessage, Bot bot)
{
FullMessage.Replace(@"\s+", " ");
string[] Words = FullMessage.Split(' ');
string Message = FullMessage.Remove(0, Words[0].Length + (Words.Length > 1).GetHashCode()); ;
if (Words.Length > 1)
{
Message = FullMessage.Remove(Words[0].Length + 1); //TODO GET THIS PART FIXED
}
//base.OnChatRoomMessage(chatID, sender, message);
bool rank = UserDatabaseHandler.admincheck(sender);
foreach (KeyValuePair<string, string> Entry in GroupChatHandler.DataLOG) //TODO Disable autocorrections
{
if (Words[0].StartsWith(Entry.Key, StringComparison.OrdinalIgnoreCase))
{
return GroupChatHandler.AdvancedGoogleSearch(Message, Entry.Value, chatID);
}
}
foreach (KeyValuePair<string, string> Entry in GroupChatHandler.InstantReplies) //TODO Disable autocorrections
{
if (FullMessage.StartsWith(Entry.Key, StringComparison.OrdinalIgnoreCase))
{
return Entry.Value;
}
}
if (DoesMessageStartWith(Words[0], ChatCommands["SteamIDCommand"].Item2))
{
if (Words.Length > 0)
{
return GroupChatHandler.GetSteamIDFromUrl(Words[1], true);
}
else {
return "URL is missing, please add a url";
}
}
if (DoesMessageStartWith(Words[0], ChatCommands["MySteamIDCommand"].Item2))
{
return sender.ToString();
}
if (DoesMessageStartWith(Words[0], ChatCommands["Rejoin"].Item2))
{
bot.SteamFriends.JoinChat(new SteamID(GroupChatHandler.Groupchat));
}
if (DoesMessageStartWith(Words[0], ChatCommands["MOTDSetter"].Item2))
{
return BackgroundWork.MOTDSetter;
}
if (DoesMessageStartWith(Words[0], ChatCommands["MOTDTick"].Item2))
{
return BackgroundWork.MOTDPosted.ToString();
}
if (DoesMessageStartWith(Words[0], ChatCommands["MOTD"].Item2))
{
return BackgroundWork.MOTD;
}
if (DoesMessageStartWith(Words[0], ChatCommands["Sync"].Item2))
{
BackgroundWork.SheetSync(true);
return null;
}
if (DoesMessageStartWith(Words[0], ChatCommands["UploadCheckCommand"].Item2))
{
if (Words.Length > 0) {
return GroupChatHandler.UploadCheck(Words[1]).ToString();
}
else {
return "No map specified";
}
}
if (DoesMessageStartWith(Words[0], ChatCommands["DeleteCommands"].Item2))
{
if (Words.Length > 2)
{
string[] Reason = Message.Split(new string[] { Words[1] }, StringSplitOptions.None);
Tuple<string, SteamID> removed = ImpMaster.ImpRemove(Words[1], sender, false, Reason[1]);
return "Removed map: " + removed.Item1;
}
else
{
Tuple<string, SteamID> removed = ImpMaster.ImpRemove(Words[1], sender, false, "(None)");
return "Removed map: " + removed.Item1;
}
}
if (DoesMessageStartWith(Words[0], ChatCommands["ImpCommands"].Item2))
{
//.........这里部分代码省略.........
示例7: admincommands
/// <summary>
/// The commands that users can use by msg'ing the system. Returns a string with the appropriate responses
/// </summary>
/// <param name="chatID">ChatID of the chatroom</param>
/// <param name="message">The message sent</param>
public static string admincommands(SteamID sender, string FullMessage , Bot Bot)
{
FullMessage.Replace(@"\s+", " ");
string[] Words = FullMessage.Split();
string Message = FullMessage.Remove(0, Words[0].Length + (Words.Length > 1).GetHashCode());
if (DoesMessageStartWith(Words[0], ChatCommands["Rejoin"].Item2))
if (FullMessage.StartsWith("!ReJoin", StringComparison.OrdinalIgnoreCase))
{
Bot.SteamFriends.LeaveChat(new SteamID(GroupChatHandler.Groupchat));
Bot.SteamFriends.JoinChat(new SteamID(GroupChatHandler.Groupchat));
}
if (Words[0].StartsWith("!Say", StringComparison.OrdinalIgnoreCase))
{
Bot.SteamFriends.SendChatRoomMessage(GroupChatHandler.Groupchat, EChatEntryType.ChatMsg, Message);
}
if(DoesMessageStartWith(Words[0], ChatCommands["SetMOTD"].Item2))
{
if (Message != null)
{
if (BackgroundWork.MOTD != null)
{
return "There is currently a MOTD, please remove it first";
}
else
{
BackgroundWork.MOTDSetter = Bot.SteamFriends.GetFriendPersonaName(sender) + " " + sender;
BackgroundWork.MOTD = Message;
return "MOTD Set to: " + Message;
}
}
else
{
return "Make sure to include a MOTD to display!";
}
}
if (Message.StartsWith("Say my name", StringComparison.OrdinalIgnoreCase))
{
return Bot.SteamFriends.GetFriendPersonaName(sender);
}
if(DoesMessageStartWith(Words[0], ChatCommands["RemoveMOTD"].Item2))
{
BackgroundWork.MOTD = null;
return "Removed MOTD";
}
if (DoesMessageStartWith(Words[0], ChatCommands["ClearCommands"].Item2))
{
ImpMaster.WipeAllMaps();
return "Wiped all Maps";
}
if (DoesMessageStartWith(Words[0], ChatCommands["EnableSync"].Item2))
{
GroupChatHandler.OnlineSync = "true";
GroupChatHandler.groupchatsettings.Remove("OnlineSync");
GroupChatHandler.groupchatsettings.Add("OnlineSync", "true");
System.IO.File.WriteAllText(@"ExtraSettings.json", JsonConvert.SerializeObject(GroupChatHandler.ExtraSettingsData));
return "Enabled Sync";
}
if (DoesMessageStartWith(Words[0], ChatCommands["DisableSync"].Item2))
{
GroupChatHandler.OnlineSync = "false";
GroupChatHandler.groupchatsettings.Remove("OnlineSync");
GroupChatHandler.groupchatsettings.Add("OnlineSync", "false");
System.IO.File.WriteAllText(@"ExtraSettings.json", JsonConvert.SerializeObject(GroupChatHandler.ExtraSettingsData));
return "Disabled Sync";
}
if (DoesMessageStartWith(Words[0], ChatCommands["EnableRSS"].Item2))
{
GroupChatHandler.EnableRSS = true;
return "Enabled RSS";
}
if (DoesMessageStartWith(Words[0], ChatCommands["DisableRSS"].Item2))
{
GroupChatHandler.EnableRSS = false;
return "Disabled RSS";
}
if (DoesMessageStartWith(Words[0], ChatCommands["Rejoin"].Item2))
{
Bot.SteamFriends.LeaveChat(new SteamID(GroupChatHandler.Groupchat));
Bot.SteamFriends.JoinChat(new SteamID(GroupChatHandler.Groupchat));
}
if (DoesMessageStartWith(Words[0], ChatCommands["Unban"].Item2))
{
if (Words.Length > 1) ;
string Userid = GroupChatHandler.GetSteamIDFromUrl(Words[1], true);
if (UserDatabaseHandler.BanList.ContainsKey(Userid.ToString()))
{
UserDatabaseHandler.BanList.Remove(Userid);
return "The ban has now been lifted";
}
else
{
//.........这里部分代码省略.........
示例8: ImpEntryUpdate
/// <summary>
/// Updates a map in the maplist, and keeps the position in the array
/// </summary>
/// <param name="maptochange"></param>
/// <param name="map"></param>
/// <param name="downloadurl"></param>
/// <param name="notes"></param>
/// <param name="sender"></param>
/// <returns></returns>
public string ImpEntryUpdate(string maptochange, string map, string downloadurl, string notes, SteamID sender)
{
Log.Interface("Reached Here");
if (notes == null)
{
notes = "No Notes";
}
int EntryCount = 0;
if (admincheck(sender) == true | sender.Equals(Maplist[maptochange].Item2))
{
foreach (KeyValuePair<string, Tuple<string, string, string, bool>> entry in Maplist)
{
EntryCount = EntryCount + 1;
if (entry.Key == maptochange)
{
UpdateEntryExecute(EntryCount, maptochange, map, downloadurl, notes, sender.ToString());
return "Map has been updated";
}
}
}
return "The entry was not found";
}
示例9: OnChatRoomMessage
/// <summary>
/// The method executed upon the bot receiving messages in group chat
/// </summary>
/// <param name="chatID">The SteamID of the chatroom</param>
/// <param name="sender"> The SteamID of the person who sent the msg</param>
/// <param name="message">The message</param>
public override void OnChatRoomMessage(SteamID chatID, SteamID sender, string message)
{
GhostCheck = 120;
string adminresponse = null;
if (admincheck(sender))
{
adminresponse = admincommands(sender, message);
}
string response = null;
if (!BanList.ContainsKey(sender.ToString()) || admincheck(sender))
{
response = Chatcommands(chatID, sender, message);
if (response != null)
{
Bot.SteamFriends.SendChatRoomMessage(Groupchat, EChatEntryType.ChatMsg, response);
}
}
else
{
}
if (adminresponse != null)
{
Bot.SteamFriends.SendChatRoomMessage(Groupchat, EChatEntryType.ChatMsg, adminresponse);
}
}
示例10: ImpEntry
/// <summary>
/// Adds a map to the database
/// </summary>
public string ImpEntry(string map, string downloadurl, string notes, SteamID sender)
{
if (notes == null)
{
notes = "None";
}
//Deserialises the current map list
string response = "Failed to add the map to the list";
Dictionary<string, Tuple<string, string, string, bool>> entrydata = Maplist;
if (Maplist == null)
{
Log.Interface("There was an error, here is the map file before it's wiped:" + System.IO.File.ReadAllText(@MapStoragePath));
}
if (entrydata.ContainsKey(map))
{ //if it already exists, it deletes it so it can update the data
response = "Error, the entry already exists! Please remove the existing entry";
}
else
{
//Adds the entry
entrydata.Add(map, new Tuple<string, string, string, bool>(downloadurl, sender.ToString(), notes, UploadCheck(map)));
//Saves the data
Maplist = entrydata;
response = "Added: " + map;
}
System.IO.File.WriteAllText(@MapStoragePath, JsonConvert.SerializeObject(entrydata));
SpreadsheetSync = true;
return response;
}
示例11: Chatcommands
/// <summary>
/// The commands that users can use by msg'ing the system. Returns a string with the appropriate responses
/// </summary>
/// <param name="chatID">ChatID of the chatroom</param>
/// <param name="sender">STEAMID of the sender</param>
/// <param name="message">The message sent</param>
public string Chatcommands(SteamID chatID, SteamID sender, string FullMessage)
{
Utilities utilities = new Utilities();
base.OnChatRoomMessage(chatID, sender, FullMessage);
bool rank = admincheck(sender);
FullMessage.Replace(@"\s+", " ");
string[] Words = FullMessage.Split();
string Message = FullMessage.Remove(0, ((Words[0].Length) * (Words.Length > 1).GetHashCode()) + (Words.Length > 1).GetHashCode());
foreach (KeyValuePair<string, string> Entry in DataLOG) //TODO Disable autocorrections
{
if (Words[0].StartsWith(Entry.Key, StringComparison.OrdinalIgnoreCase))
{
return AdvancedGoogleSearch(Message, Entry.Value, chatID);
}
}
if (DoesMessageStartWith(Words[0], ChatCommandsArray["SteamIDCommand"].Item2))
{
if (Words.Length > 0)
{
return GetSteamIDFromUrl(Words[1], true);
}
else
{
return "URL is missing, please add a url";
}
}
if (DoesMessageStartWith(Words[0], ChatCommandsArray["MySteamIDCommand"].Item2))
{
return sender.ToString();
}
if (DoesMessageStartWith(Words[0], ChatCommandsArray["Rejoin"].Item2))
{
Bot.SteamFriends.JoinChat(new SteamID(Groupchat));
}
if (DoesMessageStartWith(Words[0], ChatCommandsArray["MOTDSetter"].Item2))
{
return MOTDSetter;
}
if (DoesMessageStartWith(Words[0], ChatCommandsArray["MOTDTick"].Item2))
{
return MOTDPosted.ToString();
}
if (DoesMessageStartWith(Words[0], ChatCommandsArray["MOTD"].Item2))
{
return MOTD;
}
if (DoesMessageStartWith(Words[0], ChatCommandsArray["Sync"].Item2))
{
SheetSync(true);
return null;
}
if (DoesMessageStartWith(Words[0], ChatCommandsArray["UploadCheckCommand"].Item2))
{
if (Words.Length > 0)
{
return UploadCheck(Words[1]).ToString();
}
else
{
return "No map specified";
}
}
if (DoesMessageStartWith(Words[0], ChatCommandsArray["DeleteCommands"].Item2))
{
string[] Reason = Message.Split(new string[] { Words[1] }, StringSplitOptions.None);
Tuple<string, SteamID> removed = ImpRemove(Words[1], sender.ToString(), false, Reason[1]);
return "Removed map: " + removed.Item1;
}
if (DoesMessageStartWith(Words[0], ChatCommandsArray["ImpCommands"].Item2))
{
if (Words.Length == 1)
{
return "!add <mapname> <url> <notes> is the command. however if the map is uploaded you do not need to include the url";
}
int length = (Words.Length > 2).GetHashCode(); //Checks if there are more than 3 or more words
int Uploaded = (UploadCheck(Words[1])).GetHashCode(); //Checks if map is uploaded. Crashes if only one word //TODO FIX THAT
string UploadStatus = "Uploaded"; //Sets a string, that'll remain unless altered
if (length + Uploaded == 0)
{ //Checks if either test beforehand returned true
return "Make sure to include the download URL!";
}
else
{
string[] notes = FullMessage.Split(new string[] { Words[2 - Uploaded] }, StringSplitOptions.None); //Splits by the 2nd word (the uploadurl) but if it's already uploaded, it'll split by the map instead
//.........这里部分代码省略.........
示例12: admincommands
//.........这里部分代码省略.........
OnlineSync = "true";
groupchatsettings.Remove("OnlineSync");
groupchatsettings.Add("OnlineSync", "true");
System.IO.File.WriteAllText(@"ExtraSettings.json", JsonConvert.SerializeObject(ExtraSettingsData));
return "Enabled Sync";
}
if (DoesMessageStartWith(Words[0], ChatCommandsArray["DisableSync"].Item2))
{
OnlineSync = "false";
groupchatsettings.Remove("OnlineSync");
groupchatsettings.Add("OnlineSync", "false");
System.IO.File.WriteAllText(@"ExtraSettings.json", JsonConvert.SerializeObject(ExtraSettingsData));
return "Disabled Sync";
}
if (DoesMessageStartWith(Words[0], ChatCommandsArray["EnableRSS"].Item2))
{
EnableRSS = true;
return "Enabled RSS";
}
if (DoesMessageStartWith(Words[0], ChatCommandsArray["DisableRSS"].Item2))
{
EnableRSS = false;
return "Disabled RSS";
}
if (DoesMessageStartWith(Words[0], ChatCommandsArray["Rejoin"].Item2))
{
Bot.SteamFriends.LeaveChat(new SteamID(Groupchat));
Bot.SteamFriends.JoinChat(new SteamID(Groupchat));
}
if (DoesMessageStartWith(Words[0], ChatCommandsArray["Unban"].Item2))
{
if (Words.Length > 1) ;
string Userid = GetSteamIDFromUrl(Words[1], true);
if (BanList.ContainsKey(Userid.ToString()))
{
BanList.Remove(Userid);
System.IO.File.WriteAllText(@BanListFilePath, JsonConvert.SerializeObject(BanList));
return "The ban has now been lifted";
}
else
{
return "User is not banned";
}
}
if (DoesMessageStartWith(Words[0], ChatCommandsArray["AddCommands"].Item2))
{
if (Words.Length > 1)
{
foreach (KeyValuePair<string, Tuple<string, List<string>>> Entry in ChatCommandsArray)
{
if (Entry.Value.Item2.Contains(Words[1], StringComparer.OrdinalIgnoreCase))
{
foreach (KeyValuePair<string, Tuple<string, List<string>>> EntryRecheck in ChatCommandsArray)
{
if (EntryRecheck.Value.Item2.Contains(Words[2], StringComparer.OrdinalIgnoreCase))
{
return "Sorry this command already exists!";
}
else
{
if (Words[2].StartsWith("!"))
{
Entry.Value.Item2.Add(Words[2]);
示例13: Respond
private bool Respond(SteamID toID, SteamID userID, string message)
{
Dictionary<SteamID, Dictionary<SteamID, int>> groups = Options.AntiSpamTriggerOptions.groups;
AntiSpamTriggerOptions options = Options.AntiSpamTriggerOptions;
if(!groups.ContainsKey(toID))
{
groups[toID] = new Dictionary<SteamID, int>();
}
if(!groups[toID].ContainsKey(userID))
{
groups[toID][userID] = 0;
}
groups[toID][userID] += options.msgPenalty;
if(groups[toID][userID] >= options.score.warn && groups[toID][userID] <= options.score.warnMax)
{
Log("warning", userID, toID);
SendMessageAfterDelay(userID, options.warnMessage, false);
return true;
}
else if(groups[toID][userID] >= options.score.kick)
{
Log("kicking", userID, toID);
Bot.steamFriends.KickChatMember(toID, userID);
return true;
}
else if (groups[toID][userID] >= options.score.ban)
{
Log("banning", userID, toID);
Timer unban = new Timer(options.timers.unban);
unban.Elapsed += new ElapsedEventHandler((sender, e) => Unban_Elapsed(sender, e, toID, userID));
return true;
}
else if (groups[toID][userID] >= options.score.tattle && groups[toID][userID] <= options.score.tattleMax)
{
Log("tattling on", userID, toID);
foreach(SteamID admin in options.admins)
{
SendMessageAfterDelay(admin, Bot.steamFriends.GetFriendPersonaName(userID) + " is spamming in https://steamcommunity.com/gid/" + toID.ToString(), false);
}
return true;
}
return false;
}
示例14: Log
/// <summary>
/// Logs bot actions to the console
/// </summary>
/// <param name="prefix">Action that was taken</param>
/// <param name="userID">The user to act upon</param>
/// <param name="groupID">The group the action is taking place in</param>
/// <param name="reason">Reason they had action taken upon them</param>
private void Log(string prefix, SteamID userID, SteamID groupID, string reason)
{
string message = string.Format("{0}/{1}: {2} {3} for spamming in https://steamcommunity.com/gid/{4} to prevent spam ({5})", Bot.username, Name, prefix, Bot.steamFriends.GetFriendPersonaName(userID), groupID.ToString(), reason);
SteamChatBot.Log.Instance.Info(message);
}