Skip to content
This repository has been archived by the owner on May 5, 2024. It is now read-only.

Commit

Permalink
Sort imports and delete ApiConnector and ApiRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
pixeldeee committed Aug 3, 2023
1 parent 2d46d5c commit 8967719
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 32 deletions.
2 changes: 1 addition & 1 deletion pytecord/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from .client import Client
from .guild import Guild, GuildChannel, Message, MessageDeleteEvent
from .guild import Guild, GuildChannel, Message, MessageDeleteEvent
7 changes: 3 additions & 4 deletions pytecord/client.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
from .web import BaseWebhook
from asyncio import run as arun
from typing import TYPE_CHECKING, Any, Callable, Coroutine, Literal

from typing import TYPE_CHECKING, Literal, Callable, Coroutine, Any

from .guild import Message, Guild, GuildChannel, MessageDeleteEvent
from .enums import GatewayIntents
from .guild import Guild, GuildChannel, Message, MessageDeleteEvent
from .user import User
from .web import BaseWebhook

if TYPE_CHECKING:
from .web import GatewayOutput
Expand Down
2 changes: 1 addition & 1 deletion pytecord/config.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
GATEWAY_VERSION = 10
API_VERSION = 10
API_VERSION = 10
4 changes: 2 additions & 2 deletions pytecord/guild.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from typing import Any

from .interfaces import Object
from .user import User
from .utils import MessagePayload, apost, rget

from .interfaces import Object
from .utils import rget, apost, MessagePayload

class Guild(Object):
def __init__(self, data: dict[str, Any], token: str):
Expand Down
3 changes: 1 addition & 2 deletions pytecord/interfaces.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from abc import ABC as AbstractClass
from abc import abstractmethod as abstract_method

from typing import Any, TYPE_CHECKING
from typing import TYPE_CHECKING, Any

if TYPE_CHECKING:
from pytecord.web import GatewayOutput
Expand Down
4 changes: 3 additions & 1 deletion pytecord/user.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from .interfaces import Object
from typing import Any

from .interfaces import Object


class User(Object):
def __init__(self, data: dict[str, Any], token: str) -> None:
self.__token = token
Expand Down
7 changes: 4 additions & 3 deletions pytecord/utils.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from requests import get, post
from aiohttp import ClientSession
import json
from typing import Any, Literal

from typing import Literal, Any
from aiohttp import ClientSession
from requests import get, post

from .config import API_VERSION


class MessagePayload:
def __init__(self, content: str) -> None:
self.json = {
Expand Down
25 changes: 7 additions & 18 deletions pytecord/web.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,19 @@
from .interfaces import BaseDataStreamListener

from typing import Callable, Coroutine, Any, TYPE_CHECKING
from aiohttp import ClientSession
from asyncio import create_task, gather
from asyncio import sleep as asleep
from datetime import datetime
from time import mktime
from asyncio import gather, create_task
from asyncio import sleep as asleep
from typing import TYPE_CHECKING, Any, Callable, Coroutine

from aiohttp import ClientSession

from .config import GATEWAY_VERSION
from .interfaces import BaseDataStreamListener
from .utils import get_headers, rget

if TYPE_CHECKING:
from .guild import Guild, GuildChannel
from .user import User

class ApiRequest:
...


class ApiConnector:
def __init__(self, api_version: int) -> None:
self.base_url = f'https://discord.com/api/v{api_version}'

def try_request(self, request: ApiRequest):
...


class GatewayRequest:
def __init__(self, op: int = None, d: dict[str, Any] = None, s: int = None, t: str = None, *, data: dict[str, Any] = None) -> None:
Expand Down Expand Up @@ -167,7 +157,6 @@ def __init__(self, token: str, debug: bool) -> None:

self.listener = DataStreamListener()
self.stream = DataStream(self.listener, self.headers, self.token, self.debug)
self.api_connector = ApiConnector(10)

def add_event(self, event_type:str, function: Callable):
self.listener.events[event_type] = function
Expand Down

0 comments on commit 8967719

Please sign in to comment.