简体中文 / English
- Go to API references page
- Quick start with Kagami
Example code snippets
// Create a bot instance
var bot = BotFather.Create(config, device, keystore);
{
// Handle the captcha
bot.OnCaptcha += (bot, e) =>
{
if(e.Type == CaptchaType.Slider)
{
Console.WriteLine(e.SliderUrl);
bot.SubmitSliderTicket(Console.ReadLine());
}
else if(e.Type == CaptchaType.Sms)
{
Console.WriteLine(e.Phone);
bot.SubmitSmsCode(Console.ReadLine());
}
};
// Print the log
bot.OnLog += (_, e)
=> Console.WriteLine(e.EventMessage);
// Handle group messages
bot.OnGroupMessage += (_, e)
=> Console.WriteLine(e.Message);
// Handle friend messages
bot.OnFriendMessage += (_, e)
=> Console.WriteLine(e.Message);
// ... More handlers
}
// Do login
if(!await bot.Login())
{
Console.WriteLine("Login failed");
return;
}
Console.WriteLine("We got online!");| Messages | Support | Operations | Support | Events | Support |
|---|---|---|---|---|---|
| Images | 🟢 | Poke | 🟢 | Captcha | 🟢 |
| Text / At | 🟢 | Recall | 🟡1 | BotOnline | 🟢 |
| Records | 🟢 | Leave Group | 🟢 | BotOffline | 🟢 |
| QFace | 🟢 | Special Title | 🟢 | Message | 🟡2 |
| Json | 🟢 | Kick Member | 🟢 | Poke | 🟢 |
| Xml | 🟢 | Mute Member | 🟢 | MessageRecall | 🟢 |
| Forward | 🟡3 | Set Admin | 🟢 | GroupMemberDecrease | 🟢 |
| Video | 🔴 | Friend Request | 🟢 | GroupMemberIncrease | 🟢 |
| Flash Image | 🟢 | Group Request | 🟢 | GroupPromoteAdmin | 🟢 |
| Reply | 🟢 | Voice Call | 🔴 | GroupInvite | 🟢 |
| File | 🔴 | Csrf Token | 🟢 | GroupRequestJoin | 🟢 |
| Cookies | 🔴 | FriendRequest | 🟢 | ||
| FriendTyping | 🟢 | ||||
| FriendVoiceCall | 🔴 |
Special thanks to JetBrains offers free open-source licenses for us!
Licensed in GNU GPLv3 with ❤.