setOwner method
Update the owner of this
Warning : This method only works if the server was created via a discord bot and the bot is the current owner
See documentation
Example :
final member = guild.members.cache.get('240561194958716924');
if (member != null) {
await guild.setOwner(member);
}
Implementation
Future<void> setOwner (GuildMember guildMember) async {
MineralClient client = ioc.use<MineralClient>();
if (owner.id != client.user.id) {
ioc.use<MineralCli>().console.error("You cannot change the owner of the server because it does not belong to the ${client.user.username} client.");
return;
}
Response response = await ioc.use<HttpService>().patch(url: "/guilds/$id", payload: { 'owner_id': guildMember.user.id });
if (response.statusCode == 200) {
_ownerId = guildMember.id;
}
}