requestChannelMessages function
requestChannelMessages is to GET
the list of all messages
Implementation
Future requestChannelMessages() async {
Uri url = Uri.parse(
"https://discord.com/api/v10/channels/${DiscordLogger.instance.channelId}/messages");
final response = await http.get(
url,
headers: {
"Accept": "application/json",
"Content-Type": "application/json",
"Authorization": "Bot ${DiscordLogger.instance.botToken}",
},
);
if (response.statusCode == 200) {
return discordMessageModelFromJson(response.body);
} else {
return false;
}
}