11
This commit is contained in:
parent
81447acb4a
commit
b8b1c59875
@ -21,6 +21,7 @@ namespace asg_form
|
||||
public string? chinaname { get; set; }
|
||||
|
||||
public string? officium { get; set; }
|
||||
public string? qqnumber { get; set; }
|
||||
|
||||
public int point { get; set; }
|
||||
|
||||
|
@ -32,6 +32,7 @@ using Flandre.Core.Messaging;
|
||||
using Flandre.Core.Common;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Flurl.Http;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
|
||||
namespace asg_form
|
||||
{
|
||||
@ -44,6 +45,16 @@ namespace asg_form
|
||||
public class qqbot:Plugin
|
||||
{
|
||||
|
||||
private readonly RoleManager<Role> roleManager;
|
||||
private readonly UserManager<User> userManager;
|
||||
public qqbot(
|
||||
RoleManager<Role> roleManager, UserManager<User> userManager)
|
||||
{
|
||||
|
||||
this.roleManager = roleManager;
|
||||
this.userManager = userManager;
|
||||
}
|
||||
|
||||
[Command]
|
||||
public string 查询选手(string name)
|
||||
{
|
||||
@ -229,6 +240,23 @@ namespace asg_form
|
||||
|
||||
|
||||
|
||||
[Command]
|
||||
public async Task<string> 绑定QQ(string username, MessageContext ctx)
|
||||
{
|
||||
try
|
||||
{
|
||||
var user= await userManager.FindByNameAsync(username);
|
||||
user.qqnumber = ctx.UserId;
|
||||
await userManager.UpdateAsync(user);
|
||||
return $"绑定成功!\r\n姓名:{user.chinaname}";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return $"出现错误{ex.Message}";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[Command]
|
||||
public async Task<string> ai(string msg)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user