v1.2.11: Add tournaments command with filtering and improve error handling
Features: - Add /tournaments command with status and game filters - Add tournament API integration to PlayerService - Add beautiful tournament embed builders with prize pools - Protect sync-games from overwriting manual customizations - Improve error handling with proper MessageFlags Changes: - Add getTournamentsData() and getTournamentData() to PlayerService - Add tournament command handler with pagination support - Add tournament embed builders with rich formatting - Update deployment docs for v1.2.10 features - Add issue tracker documentation - Add tournament testing script - Fix ephemeral flags throughout CommandHandler - Improve permission checks with PermissionFlagsBits Version: 1.2.11
This commit is contained in:
@@ -76,6 +76,41 @@ class PlayerService {
|
||||
return `${this.baseUrl}/profile/${username}/stats`;
|
||||
}
|
||||
|
||||
async getTournamentsData() {
|
||||
try {
|
||||
console.log('Fetching tournaments data...');
|
||||
const url = `${this.baseUrl}/api/fetch/tournaments`;
|
||||
console.log(`API URL: ${url}`);
|
||||
|
||||
const response = await axios.get(url, {
|
||||
timeout: 5000,
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
validateStatus: function (status) {
|
||||
return status >= 200 && status < 300;
|
||||
}
|
||||
});
|
||||
|
||||
console.log('Tournaments API Response:', JSON.stringify(response.data, null, 2));
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.error('Error fetching tournaments data:', {
|
||||
message: error.message,
|
||||
response: error.response?.data,
|
||||
status: error.response?.status
|
||||
});
|
||||
return { success: false, error: 'Failed to fetch tournaments data' };
|
||||
}
|
||||
}
|
||||
|
||||
async getTournamentData(tournamentId) {
|
||||
const url = `${this.baseUrl}/api/get_tournament_data/${tournamentId}`;
|
||||
const response = await axios.get(url);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async findTeamByName(teamName, gameFilter) {
|
||||
try {
|
||||
// Double-check sanitization here as well for defense in depth
|
||||
|
||||
Reference in New Issue
Block a user