예제 #1
0
파일: economy.py 프로젝트: KDJDEV/Rank-bot
"""

This file houses functions and classes that pertain to the Roblox economy endpoints.

"""

from ro_py.utilities.url import url
endpoint = url("economy")


class Currency:
    """
    Represents currency data.
    """
    def __init__(self, currency_data):
        self.robux = currency_data["robux"]


class LimitedResaleData:
    """
    Represents the resale data of a limited item.
    """
    def __init__(self, resale_data):
        self.asset_stock = resale_data["assetStock"]
        self.sales = resale_data["sales"]
        self.number_remaining = resale_data["numberRemaining"]
        self.recent_average_price = resale_data["recentAveragePrice"]
        self.original_price = resale_data["originalPrice"]
예제 #2
0
"""

This file houses functions and classes that pertain to Roblox icons and thumbnails.

"""

from ro_py.utilities.errors import InvalidShotTypeError
import enum

from ro_py.utilities.url import url
endpoint = url("thumbnails")


class ReturnPolicy(enum.Enum):
    place_holder = "PlaceHolder"
    auto_generated = "AutoGenerated"
    force_auto_generated = "ForceAutoGenerated"


class ThumbnailType(enum.Enum):
    avatar_full_body = 0
    avatar_bust = 1
    avatar_headshot = 2


class ThumbnailSize(enum.Enum):
    size_30x30 = "30x30"
    size_42x42 = "42x42"
    size_48x48 = "48x48"
    size_50x50 = "50x50"
    size_60x62 = "60x62"
예제 #3
0
파일: chat.py 프로젝트: KDJDEV/Rank-bot
"""

This file houses functions and classes that pertain to chatting and messaging.

"""

from ro_py.utilities.errors import ChatError
from ro_py.users import PartialUser

from ro_py.utilities.url import url
endpoint = url("chat")


class ChatSettings:
    def __init__(self, settings_data):
        self.enabled = settings_data["chatEnabled"]
        self.is_active_chat_user = settings_data["isActiveChatUser"]


class ConversationTyping:
    def __init__(self, cso, conversation_id):
        self.cso = cso
        self.requests = cso.requests
        self.id = conversation_id

    async def __aenter__(self):
        await self.requests.post(url=endpoint + "v2/update-user-typing-status",
                                 data={
                                     "conversationId": self.id,
                                     "isTyping": "true"
                                 })
예제 #4
0
파일: groups.py 프로젝트: DohmBoyOG/ro.py
from enum import Enum

import iso8601
import asyncio

from ro_py.wall import Wall
from ro_py.roles import Role
from ro_py.users import PartialUser, BaseUser
from ro_py.events import EventTypes
from typing import Tuple, Callable
from ro_py.utilities.errors import NotFound
from ro_py.utilities.pages import Pages, SortOrder
from ro_py.utilities.clientobject import ClientObject

from ro_py.utilities.url import url
endpoint = url("groups")


class Shout:
    """
    Represents a group shout.
    """
    def __init__(self, cso, group, shout_data):
        self.cso = cso
        self.requests = cso.requests
        self.group = group
        self.data = shout_data
        self.body = shout_data["body"]
        self.created = iso8601.parse_date(shout_data["created"])
        self.updated = iso8601.parse_date(shout_data["created"])
예제 #5
0
파일: assets.py 프로젝트: KDJDEV/Rank-bot
This file houses functions and classes that pertain to Roblox assets.

"""

from ro_py.utilities.clientobject import ClientObject
from ro_py.utilities.errors import NotLimitedError
from ro_py.economy import LimitedResaleData
from ro_py.utilities.asset_type import AssetTypes
import iso8601
import asyncio
import copy

from ro_py.utilities.url import url

endpoint = url("api")


class Reseller:
    def __init__(self, user, user_asset):
        self.user = user
        self.user_asset = user_asset


class Asset(ClientObject):
    """
    Represents an asset.

    Parameters
    ----------
    cso : ro_py.utilities.clientobject.ClientSharedObject
예제 #6
0
"""

This file houses functions and classes that pertain to Roblox authenticated user account information.

"""

from datetime import datetime
from ro_py.gender import RobloxGender

from ro_py.utilities.url import url
endpoint = url("accountinformation")


class AccountInformationMetadata:
    """
    Represents account information metadata.
    """
    def __init__(self, metadata_raw):
        self.is_allowed_notifications_endpoint_disabled = metadata_raw[
            "isAllowedNotificationsEndpointDisabled"]
        """Unsure what this does."""
        self.is_account_settings_policy_enabled = metadata_raw[
            "isAccountSettingsPolicyEnabled"]
        """Whether the account settings policy is enabled (unsure exactly what this does)"""
        self.is_phone_number_enabled = metadata_raw["isPhoneNumberEnabled"]
        """Whether the user's linked phone number is enabled."""
        self.max_user_description_length = metadata_raw[
            "MaxUserDescriptionLength"]
        """Maximum length of the user's description."""
        self.is_user_description_enabled = metadata_raw[
            "isUserDescriptionEnabled"]
예제 #7
0
파일: games.py 프로젝트: KDJDEV/Rank-bot
"""

from ro_py.utilities.clientobject import ClientObject
from ro_py.thumbnails import GameThumbnailGenerator
from ro_py.utilities.errors import GameJoinError
from ro_py.utilities.baseasset import BaseAsset
from ro_py.utilities.cache import CacheType
from ro_py.users import PartialUser
from ro_py.groups import Group
from ro_py.badges import Badge
import subprocess
import json
import os

from ro_py.utilities.url import url
endpoint = url("games")


class Votes:
    """
    Represents a game's votes.
    """
    def __init__(self, votes_data):
        self.up_votes = votes_data["upVotes"]
        self.down_votes = votes_data["downVotes"]


class Game(ClientObject):
    """
    Represents a Roblox game universe.
    This class represents multiple game-related endpoints.
예제 #8
0
"""

This file houses functions and classes that pertain to Roblox client settings.

"""

import enum

from ro_py.utilities.url import url
endpoint = url("accountsettings")


class PrivacyLevel(enum.Enum):
    """
    Represents a privacy level as you might see at https://www.roblox.com/my/account#!/privacy.
    """
    no_one = "NoOne"
    friends = "Friends"
    everyone = "AllUsers"


class PrivacySettings(enum.Enum):
    """
    Represents a privacy setting as you might see at https://www.roblox.com/my/account#!/privacy.
    """
    app_chat_privacy = 0
    game_chat_privacy = 1
    inventory_privacy = 2
    phone_discovery = 3
    phone_discovery_enabled = 4
    private_message_privacy = 5
예제 #9
0
파일: trades.py 프로젝트: KDJDEV/Rank-bot
This file houses functions and classes that pertain to Roblox trades and trading.

"""
from typing import Callable, List

from ro_py.utilities.pages import Pages, SortOrder
from ro_py.assets import Asset, UserAsset
from ro_py.users import PartialUser, User
from ro_py.events import EventTypes
import iso8601
import asyncio
import enum

from ro_py.utilities.url import url
endpoint = url("trades")


def trade_page_handler(requests, this_page, args) -> list:
    trades_out = []
    for raw_trade in this_page:
        trades_out.append(PartialTrade(requests, raw_trade))
    return trades_out


class Trade:
    def __init__(self, cso, data, sender: User, send_items: List[Asset],
                 receive_items: List[Asset]):
        self.cso = cso
        self.requests = cso.requests
        self.trade_id = data['id']
예제 #10
0
"""

This file houses functions and classes that pertain to game-awarded badges.

"""

from ro_py.utilities.clientobject import ClientObject
from ro_py.utilities.baseasset import BaseAsset

from ro_py.utilities.url import url

endpoint = url("badges")


class BadgeStatistics:
    """
    Represents a badge's statistics.
    """
    def __init__(self, past_date_awarded_count, awarded_count,
                 win_rate_percentage):
        self.past_date_awarded_count = past_date_awarded_count
        self.awarded_count = awarded_count
        self.win_rate_percentage = win_rate_percentage


class Badge(ClientObject, BaseAsset):
    """
    Represents a game-awarded badge.

    Parameters
    ----------
예제 #11
0
"""

This file houses functions used for tampering with Roblox Datastores

"""

from urllib.parse import quote
from math import floor
import re

from ro_py.utilities.url import url
endpoint = url("gamepersistence")


class DataStore:
    """
    Represents the in-game datastore system for storing data for games (https://gamepersistence.roblox.com).
    This is only available for authenticated clients, and games that they own.

    Parameters
    ----------
    requests : ro_py.utilities.requests.Requests
        Requests object to use for API requests.
    place_id : int
        PlaceId to modify the DataStores for, 
        if the currently authenticated user doesn't have sufficient permissions, 
        it will raise a NotAuthorizedToModifyPlaceDataStores exception
    name : str
        The name of the DataStore, 
        as in the Second Parameter of 
        `std::shared_ptr<RBX::Instance> DataStoreService::getDataStore(const DataStoreService* this, std::string name, std::string scope = "global")`