You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# DOCSTRING"""Bot~~~Main file! Warning, please be careful when editing code unless you know what you are doing.? Please check Github before attempting to fix errors* To install the modules use `pip install -r requirments.txt`Confiurations can be made in the project.json fileFor modders:* Tip: You can make custom Extentions in the "Extentions" folder. Extentions are loaded as a Discord Cog.Client Code -> bot.pyApplication Code -> app.pyApplication UI(xml ".ui. files) -> \\QtFilesApplication Assets -> \\Assets"""# IMPORTSimportosimportjsonimportasyncioimportnest_asyncioimportselfcordfromselfcord.extimportcommandsimportappimportcolorama# MAIN CODEnest_asyncio.apply()
withopen("project.json", "r") asf:
projectFile=json.load(f)
colorama.init(autoreset=True)
client=commands.Bot(
command_prefix=projectFile["discord"]["prefix"],
self_bot=True
)
asyncdefloadCogs(): # Load Extentionsforfilenameinos.listdir('App\\Extentions'):
iffilename.endswith('.py') andfilename!="util.py":
awaitclient.load_extension(f"Extentions.{filename.removesuffix('.py')}")
@client.eventasyncdefon_ready():
print(f""" Discord User Loaded Successfully ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ Account: {client.user.id} │ {client.user.name}#{client.user.discriminator} IsBot?: {client.user.bot} Latency: {round(client.latency*1000)}ms{colorama.Fore.GREEN}Inj{colorama.Fore.LIGHTBLUE_EX}Discord{colorama.Fore.RESET} - A Quality Product by InjSuite """)
ifprojectFile["app"]["enabled"] ==True:
app.loadApp(client=client)
else:
print(f"{colorama.Fore.RED}App is disabled")
@client.command()asyncdefhello_world(ctx: commands.Context):
awaitctx.reply("Hello World!")
@client.command()asyncdefping(ctx: commands.Context):
awaitctx.send(f"Pong! {round(client.latency*1000)}ms")
# Run Botasyncdefmain():
awaitloadCogs()
awaitclient.run(projectFile["discord"]["tokens"]["primaryToken"])
asyncio.run(main())
App Code:
importsysimportosimporttimeimportjsonfromPyQt5.QtWidgetsimportQDialog, QApplication, QSplashScreen, QDesktopWidget, QStackedWidgetfromPyQt5.uicimportloadUifromPyQt5.QtCoreimportQtimportselfcordclassLoadingScreen(QSplashScreen):
# Splash Screendef__init__(self):
super(QSplashScreen, self).__init__()
loadUi("App\\QtFiles\\loading.ui", self)
# Move to CenterqtRectangle=self.frameGeometry()
centerPoint=QDesktopWidget().availableGeometry().center()
qtRectangle.moveCenter(centerPoint)
self.move(qtRectangle.topLeft())
classHome(QDialog):
# Index: 0def__init__(self, client: selfcord.Client):
self.client=clientsuper(QDialog, self).__init__()
loadUi("App\\QtFiles\\home.ui", self)
self.UsernameConfirmation.setText(f'<html><head/><body><p><span style=" font-size:26pt; color:#ffffff;">Welcome, {client.user.name}#{client.user.discriminator}</span></p></body></html>')
self.ExitButton.clicked.connect(self.ExitButton_Clicked)
self.ChangeTokenButton.clicked.connect(self.ChangeTokenButton_Clicked)
self.ConfirmServerIdButton.clicked.connect(self.ConfirmServerIdButton_Clicked)
forguildinclient.guilds:
self.ServerSelect.addItem(guild.name, guild)
defExitButton_Clicked(self):
self.close()
defChangeTokenButton_Clicked(self):
widget.setCurrentIndex(widget.currentIndex() +1)
defConfirmServerIdButton_Clicked(self):
guild=self.ServerSelect.currentData()
print(guild.id)
classSettings(QDialog):
# Index: 1def__init__(self):
super(QDialog, self).__init__()
loadUi("App\\QtFiles\\settings.ui", self)
withopen("project.json", "r") asf:
self.projectFile=json.load(f)
self.Cancel.clicked.connect(self.CancelButton_Clicked)
self.SaveChanges.clicked.connect(self.SaveChangesButton_Clicked)
defCancelButton_Clicked(self):
widget.setCurrentIndex(widget.currentIndex() -1)
defSaveChangesButton_Clicked(self):
Token=self.Token.text()
Prefix=self.Prefix.text()
ifos.path.exists("project.json"):
withopen("project.json", "w") asf:
changes=self.projectFilechanges["discord"]["tokens"]["primaryToken"] =TokenifToken!=Noneelseself.projectFile["discord"]["tokens"]["primaryToken"]
changes["discord"]["prefix"] =PrefixifPrefix!=Noneelseself.projectFile["discord"]["prefix"]
f.write(json.dumps(
changes,
indent=4
))
else:
print(""" project.json File Does Not Exist ▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬ It seems that this folder(\\App) does not have a project.json file. project.json file has been auto-generated for you. ! If you are simply inputing your token in c Token: ??? Prefix: ??? """)
defloadApp(client: selfcord.Client):
app=QApplication(sys.argv)
globalwidgetwidget=QStackedWidget()
Splash=LoadingScreen()
MainPage=Home(client=client)
SettingsPage=Settings()
widget.addWidget(MainPage)
widget.addWidget(SettingsPage)
widget.setFixedSize(900, 525)
Splash.show()
time.sleep(5)
Splash.close()
widget.show()
app.exec_()
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Bot Code:
App Code:
Erorr:
Why I am I getting this error? And how do I fix it?
Beta Was this translation helpful? Give feedback.
All reactions