All APIs on resources.json

This commit is contained in:
Luquinhas 2025-02-07 23:37:09 -03:00
parent b0d9e55edf
commit 2d02e6213f
No known key found for this signature in database
GPG key ID: D9B075FC6DC93985
11 changed files with 49 additions and 28 deletions

View file

@ -2,6 +2,7 @@
// Copyright (c) 2024 BubbalooTeam. (https://github.com/BubbalooTeam)
// Minor code changes by lucmsilva (https://github.com/lucmsilva651)
const Resources = require('../props/resources.json');
const axios = require('axios');
const { getStrings } = require('../plugins/checklang.js');
const { isOnSpamWatch } = require('../plugins/lib-spamwatch/spamwatch.js');
@ -46,7 +47,7 @@ module.exports = (bot) => {
const apiKey = process.env.weatherKey;
try {
const locationResponse = await axios.get('https://api.weather.com/v3/location/search', {
const locationResponse = await axios.get(`${Resources.weatherApi}/location/search`, {
params: {
apiKey: apiKey,
format: 'json',
@ -69,7 +70,7 @@ module.exports = (bot) => {
const countryCode = locationData.countryCode[0];
const { temperatureUnit, speedUnit, apiUnit } = getLocaleUnit(countryCode);
const weatherResponse = await axios.get('https://api.weather.com/v3/aggcommon/v3-wx-observations-current', {
const weatherResponse = await axios.get(`${Resources.weatherApi}/aggcommon/v3-wx-observations-current`, {
params: {
apiKey: apiKey,
format: 'json',