2022-06-03 21:57:28 +08:00
|
|
|
import { myCache } from "../cache/index.js";
|
2022-06-02 15:45:35 +08:00
|
|
|
import { client } from "./base.js";
|
|
|
|
|
2022-06-03 21:57:28 +08:00
|
|
|
export async function getRole(guildId) {
|
|
|
|
if(!myCache.get("roleList")){
|
|
|
|
let { data } = await client.roleApi.roles(guildId);
|
|
|
|
myCache.set("roleList",data)
|
|
|
|
return data
|
|
|
|
}else{
|
|
|
|
console.log("缓存命中")
|
|
|
|
return myCache.get("roleList")
|
|
|
|
}
|
2022-06-07 16:24:16 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
export async function getGuild(name){
|
|
|
|
let { data } = await client.meApi.meGuilds();
|
|
|
|
|
|
|
|
// return data.forEach((item)=>{
|
|
|
|
// // return
|
|
|
|
// if(item.name == name){
|
|
|
|
// return item.id
|
|
|
|
// }
|
|
|
|
// })
|
|
|
|
for(const i of data){
|
|
|
|
if(i.name == name){
|
|
|
|
return i.id
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|