Discord Bot Doesn't Recognize Attributes / Imports it originally had. (Pycord, Nextcord & Replit) - discord

My discord bot was previously running on pycord and only pycord for the previous while, it had several commands and worked fine! When I tried to add nextcord to work on another command, I figured out the hard way that nextcord and pycord are incompatible, upon uninstalling nextcord, it appears that my entire discord bot doesn't recognize old attributes and tokens the way it used to before nextcord was even installed. Generating errors like
python3 -m poetry add discord
/home/runner/bbot-fixed/venv/bin/python3: No module named poetry.__main__; 'poetry' is a package and cannot be directly executed
exit status 1
Replit: Package operation failed.
,
discord.errors.LoginFailure: Improper token has been passed.
,
AttributeError: module 'discord' has no attribute 'Bot'
I've even made a new replit, set it up like I did before, and it still didn't work! putting quite a bit of time into this discord bot, and since it is my first project, I dont want to lose it over a stupid mistake I have made. Any help would be amazing and I do appreciate it.

Related

I keep getting a error while attempting to run my bot, module 'discord' has no attribute 'bot'

I am trying to run my bot currently and I keep running into the error “module 'discord' has no attribute 'bot'” and will not let me start my bot.
Here is my code:
import os
os.system("pip install py-cord")
import discord
import time
import requests
import datetime
from discord.ext import commands
from discord.utils import get from discord.ext import tasks
from discord.ext.commands import Bot
bot = discord.Bot()
#bot.event
async def on_ready():
print(f"WORKING AS {client.user}"
# commands were removed due to it not letting me post the question but the code shouldn’t be a issue with the bot. It is slash commands. I will leave the beginning of the code below.
#bot.slash_command(description="Unlock the chat.")
#commands.has_permissions(manage_channels = True)
# code was here
bot.run(mytoken)
I’ve already tried changing it from bot to client with no luck. I also already tried the specific version being 2b1. I want to use slash commands with the bot and client says there is no attribute slash commands.I do not think it’s something to do with the lower portion of the code, it’s something to do with the top of the code if you can help, please and thank you.
Your code looks perfectly fine.
However, this may be a library issue, and you're installing libraries in code (see below). If you accidentally installed discord.py, it may be causing this issue.
In the console do the following:
pip uninstall discord.py
This will uninstall discord.py
Then install the proper pycord version:
pip install -U py-cord==2.4.0
Why you want to do this manually
The reason you want to do this manually is that installing libraries in code is not supported by PIP. See more here.

How can I setup flow to check ALL files in create react app without checking node_modules?

I recently started a new React project using create-react-app. From the beginning I have been integrating flow into all of the files, and it has been working wonderfully!
After adding // #flow to the beginning of every new file created in the project, I wanted to bypass this and have flow automatically check all files without needing the comment at the top. As the documentation suggests, I changed my .flowconfig file to be
[ignore]
.*/node_modules/.*
[include]
[libs]
[lints]
[options]
all=true
[strict]
After adding these two lines, any time I try to run flow from the terminal the process ultimately waits on the message flow is still initializing; this can take some time. [merging inference] (I waited for about 5 minutes and the message never went away). After removing the all option, it began working quickly as expected.
My question then is how can I use the all option in this situation and still have flow work in an ordinary amount of time? I'm assuming it's because flow is still looking in node_modules and is taking a long time to figure out that folder, but I can't seem to make flow ignore it like I want. Thanks for your help!
Immediately after posting this question, I realized maybe I wasn't ignoring enough. After ignoring the build folder as well I was able to get flow to work as I was expecting. This is how my .flowconfig file ended up
[ignore]
.*/node_modules/.*
.*/build/.*
[include]
[libs]
[lints]
[options]
all=true
[strict]
Hopefully this helps someone else in the same situation!

Errors in Routes requests

im working in a project using angularjs and laravel, but i have a bug i think in my application, im not sure since it happens sometimes, not always. Basically when i open or run my application are made some requests to some routes, but sometimes give me a 500 error, and than the error that is shown in the preview is:
RuntimeException in ApiServiceProvider.php line 88:
Unable to boot ApiServiceProvider, configure an API domain or prefix.
I searched online this error and didnt find much info related with this error, does someone have a idea what could it be?
Yes I have solved the problem, the thing is that you are missing configurations.
The way to solve it you have to make a copy of .env.example file and rename it to .env
Do not forget to change you database configurations.
The problem was missing domain or prefix. which is in your case is:
API_PREFIX=api
I`m sure that it should solve your problem.
Helpful hint turn on your debugging environment in config/app.php to 'debug' => env('APP_DEBUG', true)
so you can be more specific with error messages.
I had same problem even if API_PREFIX was set in my .env file.
Simple solution that I found after long struggle was to clear cache:
php artisan chache:clear
php artisan config:cache

Class 'SqlFormatter' is missing CAKEPHP 3 DebugKit

I've just installed the latest Debugkit from https://github.com/cakephp/debug_kit.
Everything is working. However, when I clicked on the "SQL Log", the CakePHP logo keeps spinning. I tried to debug by opening up the console.log and saw an 500 error. It shows the below.
Error: Class 'SqlFormatter' not found
File /Applications/MAMP/htdocs/App/vendor/cakephp/debug_kit/src/Template/Element/sql_log_panel.ctp
Line: 24
From my understanding, SqlFormatter class is not found in sql_log_panel.ctp. How can I add/declare the SqlFormatter class?
Just install it via composer, problem very likely solved then.
https://getcomposer.org/doc/00-intro.md
http://book.cakephp.org/3.0/en/installation.html#installing-cakephp
I highly recommend you to become familiar with composer, it is a standard tool for php developers for some time now. Composer will automatically install the dependencies for you.
Your second best option would be to download the SqlFormatter package manually from where ever it comes from and set your autoloading or include manually up.

Angular JS , putting the angular-1.2.27\docs\index.html to run

I'm starting to learn angularjs , but i found some things that didnt make sense for me. Im using chrome into a windows 8 machine.
First i downloaded the angularjs zip version from : https://angularjs.org/
folowing i did unzip the files in some directory.
Then i wanted to just take a look into the documentation into angular-1.2.27\docs\index.html.
The result is weird ,the menus doesnt works, the screen takes a long time to load and let it with a loading message into the middle of it.
Does it needs to be in a server ? since its all about javascrit it shouldnt work all by himself?
Well for anybody that arives here, the question i raised was a misundestand of the Tutorial and the other places i read about it.
In the case above, my mistake was that i suposed that i needed do run the npm install anywhere , but it should be run inside the project that needed the dependences that are related to.

Resources