修复id长度

This commit is contained in:
milimoe 2024-04-01 23:17:31 +08:00
parent 9f55aaca48
commit b37bac6209
Signed by: milimoe
GPG Key ID: 05D280912DA6C69E
3 changed files with 11 additions and 7 deletions

View File

@ -536,11 +536,14 @@ namespace Milimoe.RainBOT.ListeningTask
Bot.ColorfulCheckPass(sender, "随机叫哥", dice, GeneralSettings.PCallBrother, delay); Bot.ColorfulCheckPass(sender, "随机叫哥", dice, GeneralSettings.PCallBrother, delay);
string name = (sender.card != "" ? sender.card : sender.nickname).Trim(); string name = (sender.card != "" ? sender.card : sender.nickname).Trim();
int pos = new Random().Next(name.Length - 1); int pos = new Random().Next(name.Length - 1);
GroupMessageContent content = new(e.group_id); if (pos != -1)
content.message.Add(new AtMessage(e.user_id)); {
content.message.Add(new TextMessage(string.Concat(name.AsSpan(pos, 2), "哥"))); GroupMessageContent content = new(e.group_id);
_ = Bot.SendGroupMessage(e.group_id, "随机叫哥", content, delay * 1000); content.message.Add(new AtMessage(e.user_id));
return; content.message.Add(new TextMessage(string.Concat(name.AsSpan(pos, name.Length > 1 ? 2 : name.Length), "哥")));
_ = Bot.SendGroupMessage(e.group_id, "随机叫哥", content, delay * 1000);
return;
}
} }
} }
catch (Exception ex) catch (Exception ex)

View File

@ -53,6 +53,7 @@
MusicList.Add("igs", "file:///" + AppDomain.CurrentDomain.BaseDirectory.ToString() + @"music\igotsmoke.mp3"); MusicList.Add("igs", "file:///" + AppDomain.CurrentDomain.BaseDirectory.ToString() + @"music\igotsmoke.mp3");
MusicList.Add("劝导", "file:///" + AppDomain.CurrentDomain.BaseDirectory.ToString() + @"music\丁真劝导.mp3"); MusicList.Add("劝导", "file:///" + AppDomain.CurrentDomain.BaseDirectory.ToString() + @"music\丁真劝导.mp3");
MusicList.Add("丁真", "file:///" + AppDomain.CurrentDomain.BaseDirectory.ToString() + @"music\丁真劝导.mp3"); MusicList.Add("丁真", "file:///" + AppDomain.CurrentDomain.BaseDirectory.ToString() + @"music\丁真劝导.mp3");
MusicList.Add("change", "file:///" + AppDomain.CurrentDomain.BaseDirectory.ToString() + @"music\change.mp3");
} }
} }
} }

View File

@ -3,8 +3,8 @@
public class OSMCore public class OSMCore
{ {
public const string version = "v1.0"; public const string version = "v1.0";
public const string version2 = "Patch2 Test"; public const string version2 = "Patch2 Test2";
public const string time = "Mar. 25th, 2024"; public const string time = "Apr. 1st, 2024";
public static string Info => $"OSM Core {version} {version2}\r\nAuthor: Milimoe\r\nBuilt on {time}\r\nSee: https://github.com/milimoe"; public static string Info => $"OSM Core {version} {version2}\r\nAuthor: Milimoe\r\nBuilt on {time}\r\nSee: https://github.com/milimoe";
} }