b7c12bae1f
Co-authored-by: GabrieleYT9768 <GabrieleYT9768@users.noreply.github.com>
39 lines
No EOL
1.1 KiB
Dart
39 lines
No EOL
1.1 KiB
Dart
import 'main.dart';
|
|
import 'package:http/http.dart' as http;
|
|
import 'dart:convert';
|
|
|
|
final headerswh = {
|
|
"Content-Type": "application/json"
|
|
};
|
|
|
|
Future<http.Response> sendWH(Map content, String token, String id) {
|
|
final url = Uri.parse("$apiURL/webhooks/$id/$token");
|
|
return http.post(url, body: json.encode(content), headers: headerswh);
|
|
}
|
|
|
|
Future<http.Response> editWH(Map content, String token, String id, String mid) {
|
|
final url = Uri.parse("$apiURL/webhooks/$id/$token/messages/$mid");
|
|
return http.patch(url, body: json.encode(content), headers: headerswh);
|
|
}
|
|
|
|
Future<http.Response> getWH(String token, String id, String mid) {
|
|
final url = Uri.parse("$apiURL/webhooks/$id/$token/messages/$mid");
|
|
return http.get(url);
|
|
}
|
|
|
|
Future<http.Response> deleteWH(String token, String id, String mid) {
|
|
final url = Uri.parse("$apiURL/webhooks/$id/$token/messages/$mid");
|
|
return http.delete(url);
|
|
}
|
|
|
|
class Sender {
|
|
String? token;
|
|
Map<String, String> headers = {};
|
|
|
|
Sender(token) {
|
|
headers = {
|
|
"Content-Type": "application/json",
|
|
"Authorization": "Bot $token"
|
|
};
|
|
}
|
|
} |