Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update generator.py add another likely error (tested) #265

Open
wants to merge 11 commits into
base: dependabot/pip/cryptography-41.0.3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
“Commons Clause” License Condition v1.0
Copyright Oli 2019-2023
Copyright Oli 2019-2024

The Software is provided to you by the Licensor under the
License, as defined below, subject to the following condition.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<p align="center">
<a href="https://pepy.tech/project/partybotpackage" align="center">
<img alt="Downloads" src="https://pepy.tech/badge/partybotpackage">
<img alt="Downloads" src="https://static.pepy.tech/badge/partybotpackage">
</a>
<a href="https://www.python.org/downloads/release/python-361/" align="center">
<img alt="Python" src="https://img.shields.io/pypi/pyversions/fortnitepy">
Expand All @@ -16,7 +16,7 @@

---

## Offical Website
## official Website
[PartyBot.net](https://partybot.net)

## Discord Support
Expand Down
4 changes: 2 additions & 2 deletions fortnite.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
# Third party imports.
import partybot
import aiofiles
import fortnitepy
import rebootpy
import crayons
import aiohttp
except ModuleNotFoundError as e:
Expand Down Expand Up @@ -90,7 +90,7 @@ async def main() -> None:
timeout=3
) as r:
invite = (await r.json())['invite'] if r.status == 200 else "8heARRB"
except asyncio.TimeoutError:
except (asyncio.TimeoutError, aiohttp.client_exceptions.ContenTypeError):
invite = "8heARRB"

print(crayons.cyan(f"[PartyBot] [{datetime.datetime.now().strftime('%H:%M:%S')}] PartyBot made by xMistt. "
Expand Down
36 changes: 18 additions & 18 deletions partybot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
import asyncio

# Third party imports.
from fortnitepy.ext import commands
from rebootpy.ext import commands

import fortnitepy
import rebootpy
import crayons
import FortniteAPIAsync
import pypresence
Expand All @@ -54,13 +54,13 @@ def __init__(self, settings: BotSettings, device_auths: DeviceAuths) -> None:

super().__init__(
command_prefix='!',
auth=fortnitepy.DeviceAuth(
auth=rebootpy.DeviceAuth(
device_id=self.device_auths.device_id,
account_id=self.device_auths.account_id,
secret=self.device_auths.secret
),
status=self.settings.status,
platform=fortnitepy.Platform(self.settings.platform)
platform=rebootpy.Platform(self.settings.platform)
)

@property
Expand Down Expand Up @@ -125,7 +125,7 @@ async def event_ready(self) -> None:
print(crayons.green(self.message % f'Client ready as {self.user.display_name}.'))

if self.party.me.leader:
await self.party.set_privacy(fortnitepy.PartyPrivacy.PUBLIC)
await self.party.set_privacy(rebootpy.PartyPrivacy.PUBLIC)

# discord_exists = await self.loop.run_in_executor(None, HelperFunctions.check_if_process_running, 'Discord')

Expand All @@ -144,23 +144,23 @@ async def event_ready(self) -> None:
for pending in self.incoming_pending_friends:
try:
epic_friend = await pending.accept() if self.settings.friend_accept else await pending.decline()
if isinstance(epic_friend, fortnitepy.Friend):
if isinstance(epic_friend, rebootpy.Friend):
print(self.message % f"Accepted friend request from: {epic_friend.display_name}.")
else:
print(self.message % f"Declined friend request from: {pending.display_name}.")
except fortnitepy.HTTPException as epic_error:
except rebootpy.HTTPException as epic_error:
if epic_error.message_code != 'errors.com.epicgames.common.throttled':
raise

await asyncio.sleep(int(epic_error.message_vars[0] + 1))
await pending.accept() if self.settings.friend_accept else await pending.decline()

async def event_party_invite(self, invite: fortnitepy.ReceivedPartyInvitation) -> None:
async def event_party_invite(self, invite: rebootpy.ReceivedPartyInvitation) -> None:
await invite.accept()
print(self.message % f'Accepted party invite from {invite.sender.display_name}.')

async def event_friend_request(self, request: fortnitepy.IncomingPendingFriend) -> None:
if isinstance(request, fortnitepy.OutgoingPendingFriend):
async def event_friend_request(self, request: rebootpy.IncomingPendingFriend) -> None:
if isinstance(request, rebootpy.OutgoingPendingFriend):
return

print(self.message % f"Received friend request from: {request.display_name}.")
Expand All @@ -172,26 +172,26 @@ async def event_friend_request(self, request: fortnitepy.IncomingPendingFriend)
await request.decline()
print(self.message % f"Declined friend request from: {request.display_name}.")

async def event_party_member_join(self, member: fortnitepy.PartyMember) -> None:
async def event_party_member_join(self, member: rebootpy.PartyMember) -> None:
await FortniteAPIAsync.set_default_loadout(
self,
self.settings.to_dict(),
member
)

async def event_friend_message(self, message: fortnitepy.FriendMessage) -> None:
async def event_friend_message(self, message: rebootpy.FriendMessage) -> None:
print(self.message % f'{message.author.display_name}: {message.content}')

async def event_command_error(self, ctx: fortnitepy.ext.commands.Context,
error: fortnitepy.ext.commands.CommandError) -> None:
if isinstance(error, fortnitepy.ext.commands.errors.CommandNotFound):
if isinstance(ctx.message, fortnitepy.FriendMessage):
async def event_command_error(self, ctx: rebootpy.ext.commands.Context,
error: rebootpy.ext.commands.CommandError) -> None:
if isinstance(error, rebootpy.ext.commands.errors.CommandNotFound):
if isinstance(ctx.message, rebootpy.FriendMessage):
await ctx.send('Command not found, are you sure it exists?')
else:
pass
elif isinstance(error, fortnitepy.ext.commands.errors.MissingRequiredArgument):
elif isinstance(error, rebootpy.ext.commands.errors.MissingRequiredArgument):
await ctx.send('Failed to execute commands as there are missing requirements, please check usage.')
elif isinstance(error, fortnitepy.ext.commands.errors.PrivateMessageOnly):
elif isinstance(error, rebootpy.ext.commands.errors.PrivateMessageOnly):
pass
else:
await ctx.send(f'When trying to process !{ctx.command.name}, an error occured: "{error}"\n'
Expand Down
20 changes: 10 additions & 10 deletions partybot/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
from typing import Optional, Union

# Third party imports.
import fortnitepy
import rebootpy
import aiohttp
import crayons

from fortnitepy.ext import commands
from rebootpy.ext import commands


class ClientCommands(commands.Cog):
Expand All @@ -48,7 +48,7 @@ def __init__(self, bot: commands.Bot) -> None:
help="Sends and sets the status.\n"
"Example: !status Presence Unknown"
)
async def status(self, ctx: fortnitepy.ext.commands.Context, *, content: str) -> None:
async def status(self, ctx: rebootpy.ext.commands.Context, *, content: str) -> None:
await self.bot.set_presence(content)

await ctx.send(f'Status set to {content}')
Expand All @@ -61,7 +61,7 @@ async def status(self, ctx: fortnitepy.ext.commands.Context, *, content: str) ->
help="Clears command prompt/terminal.\n"
"Example: !clean"
)
async def clean(self, ctx: fortnitepy.ext.commands.Context) -> None:
async def clean(self, ctx: rebootpy.ext.commands.Context) -> None:
os.system('cls' if 'win' in sys.platform else 'clear')

print(crayons.cyan(self.bot.message % f'PartyBot made by xMistt. '
Expand All @@ -78,10 +78,10 @@ async def clean(self, ctx: fortnitepy.ext.commands.Context) -> None:
help="Sends and sets the status to away.\n"
"Example: !away"
)
async def away(self, ctx: fortnitepy.ext.commands.Context) -> None:
async def away(self, ctx: rebootpy.ext.commands.Context) -> None:
await self.bot.set_presence(
status=self.bot.status,
away=fortnitepy.AwayStatus.AWAY
away=rebootpy.AwayStatus.AWAY
)

await ctx.send('Status set to away, you can use !status to revert.')
Expand All @@ -94,15 +94,15 @@ async def away(self, ctx: fortnitepy.ext.commands.Context) -> None:
help="Sends the most recent commit/s.\n"
"Example: !update"
)
async def update(self, ctx: fortnitepy.ext.commands.Context) -> None:
async def update(self, ctx: rebootpy.ext.commands.Context) -> None:
async with aiohttp.ClientSession() as session:
async with session.request(
method="GET",
url="https://api.github.com/repos/xMistt/fortnitepy-bot/commits/master"
url="https://api.github.com/repos/xMistt/rebootpy-bot/commits/master"
) as request:
data = await request.json()

date = fortnitepy.Client.from_iso(data['commit']['committer']['date'])
date = rebootpy.Client.from_iso(data['commit']['committer']['date'])
pretty_date = f'{date.day}/{date.month}/{date.year} @ {date.hour}:{date.minute}'
commit_title = data['commit']['message'].split('\n')[0]

Expand All @@ -117,7 +117,7 @@ async def update(self, ctx: fortnitepy.ext.commands.Context) -> None:
help="Sends the defined user a friend request.\n"
"Example: !friend Ninja"
)
async def friend(self, ctx: fortnitepy.ext.commands.Context, *, epic_username: str) -> None:
async def friend(self, ctx: rebootpy.ext.commands.Context, *, epic_username: str) -> None:
user = await self.bot.fetch_user(epic_username)

if user is not None:
Expand Down
Loading