using emoji from different server, nextcord bot - discord.py

I'm trying to get emoji's from a another server.
I creates a server object for the server, it is a constant because I want to only pull from this server.
for emoji in main_tuple:
emoji_name_id =await server.fetch_emoji(emoji)
emoji_array.append(f"<{emoji_name_id.name.lower()}:{emoji_name_id.id}>")
error:
nextcord.ext.commands.errors.CommandInvokeError: Command raised an
exception: NotFound: 404 Not Found (error code: 10014): Unknown Emoji
I should mention I want to display it another server, I know this is probably obvious but yeah.
main_tuple is a directionary in a database that has the emoji id and name.
the error
Also the bot is part of the server it's getting the id from.
I have looked at: discord.py emoji all servers bot in
and it does not work for me.

First Issue, you are making a wrong reference.
<:Name:ID> and not <Name:ID> (if you don't see it, you missed the first colon)
Another issue,
emoji_name_id.name.lower()
Custom emojis are to have to have 'exact' name and ID as they have, by using lower method, you would be trying to reference a wrong custom emote.
For example:
The actual emote which might have the following reference <:ThisIsACoolEmote:ID>, while you are appending <:thisisacoolemote:ID> which doesn't exist
To mitigate this, you can just append str(emoji_name_id) which will automatically give you the correct emote reference which is in the format <:Name:ID:> and yes, it also will format animated emojis too, i.e:<a:Name:ID>
also fetching here might not be the best practice, you can use bot.get_emoji instead which gets emote from internal cache if you have access to member Privileged Intent.

Related

Some NFT images minted from Candy Machine V2 are not displayed

I created Candy Machine and I noticed that some NFT images are not displayed neither on wallet or solscan. Metadata and images were uploaded and pinned on Pinata using Candy Machine upload command which finished successfully.
Here is an example of broken NFT.The metadata URI is pointed to: and image is pointing to. I looked at metadata several times and could not find what is the issue and why is this happening to some of the NFTs (here is the example of valid NFT that does not have this problem).
Questions:
What is the problem with metadata which is causing image not to be displayed?
What is the best way to fix this? Metadata are mutable and I am planing to use metaboss to update URI of metadata file. Is this correct way of fixing this problem?
If you look at the URI metadata on solscan here
https://solscan.io/token/4ToXb3aD5YLpXqyZhcdp5ynpbXXFFjKjsaw1x94CTd7A#metadata
and swap to the URI version of the metadata for some reason it's returning an object keypair value out of every single character in the JSON for some reason, extremely weird. I'd highly recommended reuploading this JSON metadata file and then updating the metadata URI in the NFT to make the changes.
Metaboss is a great tool as you have researched that can do this for you.
Upload new Metadata json to ipfs or arweave.
Use Metaboss to udpate the NFT's metadata URI.
Hopefully this fixes your issue.
While not a conclusive answer as to "why" this happened, I don't really know the why. This is my first time in all the NFT's that I've seen that have behaved this way upon an upload and displaying the metadata.
If that doesn't fix your issue please stop by the Metaplex Discord server and chat with us there. :)
Edit: After further inspection it turns out your JSON file is of an invalid structure for this particular NFT so will definately need replacing.
Tony Boyle has a great point with updating your json.
Your problem gets visible when you run the json through a JSON validator.
It will show that you have too many } in there. Therefore parsing the JSON fails in solscan, phantom etc.
What you have to do is
Modify the metadata to be a valid JSON file
upload it again
update the NFT uri e.g. with metaboss (if you need to update multiple NFTs) or if its just one / a few https://sol-tools.tonyboyle.io/update-nft

how to work with a network socket (if correct term) in general and in Chrome

I have encountered something new in Chrome which I've not seen before and am unfamiliar with. It appears to be some type of persistent socket (best term I know of).
Up to now I've been familiar with each AJAX call being the way to contact a server, each with a request/response if the connection is successful. And each one would show in the Name column in the console. Plus, I could "Replay XHR" as an option. And the tabs Headers/Preview/Response/Timing were helpful. However this appears to be grouped and the data I see in the chat window I can't find in any of the JSON objects on the list. What is the correct name for this, and is there any way to see the individual headers/response from each call?
This is a screenshot:

Why are FSGetCatalogInfo and getResourceValue giving different results?

I have a piece of file access code which uses FSGetCatalogInfo to get info about a bundle (say .xyz) which itself contains a file with extension .xyz. Because FSGetCatalogInfo has been updated, I am looking to replace it with 'getResourceValue' API from Foundation layer. However, the OSType is coming incorrect from the new API.
I have also looked into the related FSSetCatalogInfo API. Do I need to do something equivalent such that the 'getResourceValue' API will start giving correct results?

How to share information between cooperating Firefox WebExtensions

I want to create a straightforward extension for Firefox.
User hovers over some word on any page
Pull the dictionary definition of that word from a file inside the extension
Display it while still hovered
I am new to Firefox add-ons and WebExtensions, so here's what I'm wondering:
I want the dictionary file(s) used by the extension to be local, instead of referring to some online website each time.
Any given user might be interested in a different part of the entire dictionary (it contains entries in different languages, users might only want their own 1 or 2 languages) so I want to avoid forcing every user to download the entire dictionary base.
The way I have seen similar add-ons handle that before Firefox 5.* is that they offer the search-and-display add-on separately from the dictionary files which are each available as add-ons in their own right, only actually doing stuff if you have the master add-on installed.
However, none of those examples seem to have been updated for the WebExtensions API and do not support more recent versions of Firefox.
I have also been unable to find how to communicate between web extensions so far.
My question being, how can I share information between 2 or more coorperating extensions to achieve what I described.
And actually, if this seems really stupid for some reason I'm unaware of, do point out any more reasonable alternatives that allow me to handle the dictionary files separately from the main extension.
Possibly related questions I found:
Communicating between 2 Firefox Add-Ons (Cross-Extension Communication)
This one is from 2010 however, thus out of date as far as I could tell.
Mozilla Addon Development - Communicating between windows with different domains
Kind of a similar situation, but they want to pull the definitions from an online source, rather than a local one.
The closest thing I found on the Mozilla browser extension website is communicating between add-on and some native applications, not quite what I need I think.
Communicating between add-ons is a normal part of the functionality of runtime.sendMessage(), runtime.connect(), runtime.onMessage, and runtime.onConnect.
Both runtime.sendMessage() and runtime.connect() have as their optional first parameter:
extensionId
For runtime.sendMessage(), this is:
string. The ID of the extension to send the message to. Include this to send the message to a different extension. If the intended recipient has set an ID explicitly using the applications key in manifest.json, then extensionId should have that value. Otherwise it should have the ID that was generated for the intended recipient.
If extensionId is omitted, the message will be sent to your own extension.
For runtime.connect(), this is:
string. The ID of the extension to connect to. If the target has set an ID explicitly using the applications key in manifest.json, then extensionId should have that value. Otherwise it should be have the ID that was generated for the target.
Both runtime.onMessage, and runtime.onConnect provide a sender property or parameter, either with the message, or as part of the port. This parameter/property is a runtime.MessageSender which includes an id property which is:
id
string. The ID of the extension that sent the message, if the message was sent by an extension. If the sender set an ID explicitly using the applications key in manifest.json, then id will have this value. Otherwise it will have the ID that was generated for the sender.
Note that in Firefox, before version 54, this value was the extension's internal ID (that is, the UUID that appears in the extension's URL).

Why does a "on a non-object" error occurs with this extension in Magento?

I'm having an Issue with a blog extension in Magento CE 1.6.2.0.
I installed this extension: Neotheme_nBlog.
I created an entry in the administrator.
Then I went to http://www.example.com/index.php/blog/ to see the recently created entry.
What I saw was an error like this:
Fatal error: Call to a member function getName() on a non-object
in /home/example.com/public_html/app/design/frontend/default/caramel/template/magicat/left.phtml
I searched in google the terms: "template/magicat/left.phtml" getName and what I only found is sites having this issue, but no support at all.
Please note: I know what does that error mean in PHP ("unfortunately" I'm not new at that). What I don't understand is what's happening with such [NON/null] object and how to fix it without killing a dozen of kittens.
Question: What can I do to solve it? What is the nature of the error, regarding Magento?(again: not PHP).
Notes: The Magento site (http://magento.stackexchange.com) is somewhat poor and strict to bring support of such nature, so asking there is not an option.
Edit (as answer to comment, and to clarify):
Neotheme is still not responding the request.
Don't know what should I look on such file (instances are not initialized there, but only accessed).
I'm using the default theme (caramel), which has esthetical changes (does not have layout changes).
It's hard to say without seeing your system specifically, but on this
template/magicat/left.phtml
It looks like you've added a template named magicat/left.phtml to your system -- either via an extension or custom development. Somewhere in this file PHP's called getName on a non-object. There's a variety of reasons this could be happening, and without seeing the specific line of code PHP's complaining about in your system, it's hard to say. It'd also be helpful to know if magicat is part of the extension or something else.
The most common reason for this error in a template is code that relies on a block being there that's been removed by another extension (eitehr via layout XML or observer methods)
$this->getLayout()->getBlock('some_block')->getName();
The next most common is people using the registry to communicate between templates and views, but a registry key not being set
Mage::registry('some_item')->getName();
Without knowing the variable and context, it's doubtful anyone will be able to help you.

Resources