This commit is contained in:
Tenzing Kandang 2026-03-30 16:10:15 +02:00
parent cd5b65b3cc
commit c5de68d6b1
6 changed files with 9 additions and 4 deletions

2
.gitignore vendored
View File

@ -4,4 +4,4 @@
/dvenv /dvenv
copy.txt copy.txt
user_location.db user_location.db
/utils/.env

View File

@ -2,12 +2,12 @@ import os
import discord import discord
import datetime import datetime
from google_auth_oauthlib.flow import InstalledAppFlow from google_auth_oauthlib.flow import InstalledAppFlow
from weather import OpenWeatherMapAPIClient from utils.weather import OpenWeatherMapAPIClient
from googleapiclient.discovery import build from googleapiclient.discovery import build
from google.oauth2.credentials import Credentials from google.oauth2.credentials import Credentials
from discord.ext import commands from discord.ext import commands
from dotenv import load_dotenv from dotenv import load_dotenv
from database import UserLocation from utils.database import UserLocation
from asyncio import to_thread from asyncio import to_thread
load_dotenv() load_dotenv()

Binary file not shown.

Binary file not shown.

View File

@ -1,10 +1,15 @@
import requests import requests
import os
from geopy.geocoders import Nominatim from geopy.geocoders import Nominatim
from dotenv import load_dotenv
load_dotenv()
WEATHER_TOKEN = os.getenv("WEATHER_TOKEN")
class OpenWeatherMapAPIClient: class OpenWeatherMapAPIClient:
def __init__(self, api_token, name): def __init__(self, api_token, name):
self.base_url = "https://api.openweathermap.org" self.base_url = "https://api.openweathermap.org"
self._api_token = "c6ee0c7c013f6d4bc9dc20982aecb6ec" self._api_token = WEATHER_TOKEN
self.name = name self.name = name
def get_geodata(self, location): def get_geodata(self, location):