Update
This commit is contained in:
parent
1d78fc94bc
commit
683e182e79
4 changed files with 67 additions and 1 deletions
26
gameutils.py
26
gameutils.py
|
@ -4,6 +4,8 @@ from nextcord import TextInputStyle
|
||||||
import random
|
import random
|
||||||
import aiosqlite as sqlite3
|
import aiosqlite as sqlite3
|
||||||
import aiohttp
|
import aiohttp
|
||||||
|
import traceback
|
||||||
|
import sys
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
@ -37,6 +39,18 @@ class TurnModal(nextcord.ui.Modal):
|
||||||
pass
|
pass
|
||||||
await interaction.followup.send(f"<@{self.fristrun.id}> it is now your turn!\n{self.text.value}")
|
await interaction.followup.send(f"<@{self.fristrun.id}> it is now your turn!\n{self.text.value}")
|
||||||
|
|
||||||
|
async def on_error(self, error: nextcord.DiscordException, interaction: nextcord.Interaction):
|
||||||
|
error = traceback.format_exc()
|
||||||
|
print(error, file=sys.stderr)
|
||||||
|
message = f"```py\n{error[-1800:]}\n```\n Contact the bot owner if the error persists"
|
||||||
|
try:
|
||||||
|
await interaction.send(message, ephemeral=True)
|
||||||
|
except:
|
||||||
|
try:
|
||||||
|
await interaction.followup.send(message, ephemeral=True)
|
||||||
|
except:
|
||||||
|
await interaction.response.send_message(message, ephemeral=True)
|
||||||
|
|
||||||
|
|
||||||
class GameView(nextcord.ui.View):
|
class GameView(nextcord.ui.View):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -79,6 +93,18 @@ class GameView(nextcord.ui.View):
|
||||||
await interaction.response.send_modal(TurnModal(message,turnping,False))
|
await interaction.response.send_modal(TurnModal(message,turnping,False))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
async def on_error(self, error: nextcord.DiscordException, item: nextcord.ui.Item, interaction: nextcord.Interaction):
|
||||||
|
error = traceback.format_exc()
|
||||||
|
print(error, file=sys.stderr)
|
||||||
|
message = f"```py\n{error[-1800:]}\n```\n Contact the bot owner if the error persists"
|
||||||
|
try:
|
||||||
|
await interaction.send(message, ephemeral=True)
|
||||||
|
except:
|
||||||
|
try:
|
||||||
|
await interaction.followup.send(message, ephemeral=True)
|
||||||
|
except:
|
||||||
|
await interaction.response.send_message(message, ephemeral=True)
|
||||||
|
|
||||||
class gameutils(commands.Cog):
|
class gameutils(commands.Cog):
|
||||||
|
|
||||||
def __init__(self, bot: commands.Bot):
|
def __init__(self, bot: commands.Bot):
|
||||||
|
|
|
@ -26,6 +26,18 @@ class RoleView(nextcord.ui.View):
|
||||||
await interaction.response.send_message(f"Added <@&{role.id}> to you!", ephemeral=True, allowed_mentions=nextcord.AllowedMentions.none())
|
await interaction.response.send_message(f"Added <@&{role.id}> to you!", ephemeral=True, allowed_mentions=nextcord.AllowedMentions.none())
|
||||||
return
|
return
|
||||||
|
|
||||||
|
async def on_error(self, error: nextcord.DiscordException, item: nextcord.ui.Item, interaction: nextcord.Interaction):
|
||||||
|
error = traceback.format_exc()
|
||||||
|
print(error, file=sys.stderr)
|
||||||
|
message = f"```py\n{error[-1800:]}\n```\n Contact <@{self.bot.owner_id}> if the error persists"
|
||||||
|
try:
|
||||||
|
await interaction.send(message, ephemeral=True)
|
||||||
|
except:
|
||||||
|
try:
|
||||||
|
await interaction.followup.send(message, ephemeral=True)
|
||||||
|
except:
|
||||||
|
await interaction.response.send_message(message, ephemeral=True)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class rolebutton(commands.Cog):
|
class rolebutton(commands.Cog):
|
||||||
|
|
|
@ -55,6 +55,19 @@ class ApplicationView(nextcord.ui.View):
|
||||||
await interaction.response.edit_message(embed=embed, view=None)
|
await interaction.response.edit_message(embed=embed, view=None)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
async def on_error(self, error: nextcord.DiscordException, item: nextcord.ui.Item, interaction: nextcord.Interaction):
|
||||||
|
error = traceback.format_exc()
|
||||||
|
print(error, file=sys.stderr)
|
||||||
|
message = f"```py\n{error[-1800:]}\n```\n Contact <@{self.bot.owner_id}> if the error persists"
|
||||||
|
try:
|
||||||
|
await interaction.send(message, ephemeral=True)
|
||||||
|
except:
|
||||||
|
try:
|
||||||
|
await interaction.followup.send(message, ephemeral=True)
|
||||||
|
except:
|
||||||
|
await interaction.response.send_message(message, ephemeral=True)
|
||||||
|
|
||||||
|
|
||||||
class ApplicationModal(nextcord.ui.Modal):
|
class ApplicationModal(nextcord.ui.Modal):
|
||||||
def __init__(self,user,bot):
|
def __init__(self,user,bot):
|
||||||
self.victim = user
|
self.victim = user
|
||||||
|
@ -88,7 +101,7 @@ class ApplicationModal(nextcord.ui.Modal):
|
||||||
)
|
)
|
||||||
print(self.image.value)
|
print(self.image.value)
|
||||||
if urlparse(self.image.value).netloc != 'media.discordapp.net' and urlparse(self.image.value).netloc != 'cdn.discordapp.com':
|
if urlparse(self.image.value).netloc != 'media.discordapp.net' and urlparse(self.image.value).netloc != 'cdn.discordapp.com':
|
||||||
await interaction.send_message(f"for security reasons, the bot only accepts images from media.discordapp.net or cdn.discordapp.com", ephemeral=True)
|
await interaction.send(f"for security reasons, the bot only accepts images from media.discordapp.net or cdn.discordapp.com", ephemeral=True)
|
||||||
return
|
return
|
||||||
async with aiohttp.ClientSession() as session:
|
async with aiohttp.ClientSession() as session:
|
||||||
async with session.get(self.image.value) as response:
|
async with session.get(self.image.value) as response:
|
||||||
|
|
15
wordpress.py
15
wordpress.py
|
@ -6,6 +6,8 @@ from random import randint
|
||||||
import aiosqlite as sqlite3
|
import aiosqlite as sqlite3
|
||||||
import requests
|
import requests
|
||||||
import json
|
import json
|
||||||
|
import traceback
|
||||||
|
import sys
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import base64
|
import base64
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
@ -75,6 +77,19 @@ class BlogModal(nextcord.ui.Modal):
|
||||||
responce = requests.post(self.endpoint, headers=header, json=post)
|
responce = requests.post(self.endpoint, headers=header, json=post)
|
||||||
await interaction.response.send_message(f"<@666378959184855042> someone posted to the blog, you should probably approve it {responce.status_code}")
|
await interaction.response.send_message(f"<@666378959184855042> someone posted to the blog, you should probably approve it {responce.status_code}")
|
||||||
|
|
||||||
|
async def on_error(self, error: nextcord.DiscordException, interaction: nextcord.Interaction):
|
||||||
|
error = traceback.format_exc()
|
||||||
|
print(error, file=sys.stderr)
|
||||||
|
message = f"```py\n{error[-1800:]}\n```\n Contact the bot owner if the error persists"
|
||||||
|
try:
|
||||||
|
await interaction.send(message, ephemeral=True)
|
||||||
|
except:
|
||||||
|
try:
|
||||||
|
await interaction.followup.send(message, ephemeral=True)
|
||||||
|
except:
|
||||||
|
await interaction.response.send_message(message, ephemeral=True)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class wordpress(commands.Cog):
|
class wordpress(commands.Cog):
|
||||||
def __init__(self, bot: commands.Bot):
|
def __init__(self, bot: commands.Bot):
|
||||||
|
|
Loading…
Reference in a new issue