Discord Bot How to Upload Images From Imgur Command Python Written By Fleming Proder Monday, April 11, 2022 Add Comment Edit Joined: Nov six, 2017 Messages: half-dozen Likes Received: 3 First of all, massive give thanks you to General Wrex#8129 at the DBM Mods server with helping me effigy this out! This is a command that lets you search for images from Imgur and posts 1 random motion-picture show from the search as a message. As a requirement, this command needs DBM Beta and https://github.com/Discord-Bot-Maker-Mods/DBM-Mods/tree/beta-1.8.2 in order to work. To brainstorm with, register your program with imgur's API in guild to get a Client ID, located here: https://api.imgur.com/oauth2/addclient , with the callback URL gear up as https://www.getpostman.com/oauth2/callback Press submit, and copy downwards the Client ID it gives you. Going back to DBM, create a new command to house this pain. For your kickoff action, make it Store Command Params with the source info as one param , param number of 1 , and a temp variable of search. The second action is where things become complicated. Brand a Run Script action with End Beliefs set as Do Not Phone call Next Activeness , Interpretation Style every bit either (don't recall information technology matters too much), and Store In to Nada . The script you demand in is this, and make you put your Customer ID nether var client_id !: var request = this.getWrexMods().crave("asking"); var url = "https://api.imgur.com/3/gallery/search/?q=" + tempVars("search"); var client_id = "<PUT YOUR CLIENT ID Here>"; var tempVarName = "imgur"; endeavour { asking.get({ url: url, json: true, headers: { 'Say-so': 'Client-ID ' + client_id } }, (err, res, data) => { if (err) { panel.error(err.stack ? err.stack : err); } this.storeValue(information, ane, tempVarName, cache); this.callNextAction(cache); }); } catch (err) { console.error(err.stack ? err.stack : err); } At present this is where things start getting easier. Make your 3rd action a Generate Random Number activity. This is and then you don't go the same image every time yous call it. Set your Minimum Range to 0, Maximum Range to 60, and make it a Temp Variable named range. 4th action is really parsing the script. Create a Parse From Stored Json, setting End Beliefs to Telephone call Next Action Automatically, Stored JSON Variable Name to imgur, the JSON path to $.data[${tempVars("range")}].id, and store information technology in a Temp Variable named imgur_image. The fifth and final activeness is just a Transport Message, with the message of https://imgur.com/gallery/${tempVars("imgur_image")} inside. You tin send it to whatsoever yous want, and it doesn't need to be stored. And there you accept information technology! You can now search for images on Imgur! Hither's a show and tell: Skillful luck, have fun, and happy holidays! Joined: Nov 6, 2017 Messages: half-dozen Likes Received: iii In case your host doesn't like the mistake catching function of the script, hither it is without that. (Information technology wasn't letting me edit) var request = this.getWrexMods().require("request"); var url = "https://api.imgur.com/iii/gallery/search/?q=" + tempVars("search"); var client_id = "3ecf3733b8b0344"; var tempVarName = "imgur"; asking.get({ url: url, json: true, headers: { 'Authorization': 'Client-ID ' + client_id } }, (err, res, data) => { if (err) { console.error(err.stack ? err.stack : err); } this.storeValue(data, i, tempVarName, enshroud); this.callNextAction(cache); }); Joined: Jan 16, 2018 Messages: 4 Likes Received: 0 Joined: Nov six, 2017 Letters: vi Likes Received: iii Ah, sad almost that. At the time of posting, information technology required that beta version but information technology looks like it's been updated. Joined: Feb 23, 2018 Messages: i Likes Received: 0 My god, information technology works like a Charms ! Thanks u for share Joined: Mar xiii, 2018 Messages: eight Likes Received: 0 this is all i continue getting when trying to search for an image. WrexMods: Could non automatically install request. (Install attempt limit reached) Please install it manually 'npm install request' before continuing. Installing Node Module: request and im not certain where to "install" what its telling me to Lasse I am always watching you! Moderator Joined: Oct 7, 2017 Messages: 161 Likes Received: 24 You demand to run your bot with node.js. But please switch to the mods server considering this is not related to the official support. Joined: Mar 13, 2018 Messages: 8 Likes Received: 0 There is a mod server? i didn't know that srry ;-; Joined: Nov vi, 2017 Letters: 6 Likes Received: iii That's an error you'll occasionally get if the search can't find anything that fits your search term. Run the control again and you'll possibly get something. If you continue to get it you may be out of luck. Joined: Apr 29, 2018 Letters: 2 Likes Received: 0 Could I send images directly from my gallery ? Thank you for help. Joined: Jul 1, 2018 Letters: one Likes Received: 0 Tin can you lot do an update for this guide as the images are unable to be seen Joined: Nov 6, 2017 Letters: 6 Likes Received: 3 I would update it, unfortunately I tin can't really edit whatsoever of my posts rn. With the update to the mods as well, there may exist a better way to do it, only I am not sure. Share This Page keensheeptiou.blogspot.com Source: https://dbotmaker.io/forums/threads/getting-pictures-from-imgur.129/ Share this post
First of all, massive give thanks you to General Wrex#8129 at the DBM Mods server with helping me effigy this out! This is a command that lets you search for images from Imgur and posts 1 random motion-picture show from the search as a message. As a requirement, this command needs DBM Beta and https://github.com/Discord-Bot-Maker-Mods/DBM-Mods/tree/beta-1.8.2 in order to work. To brainstorm with, register your program with imgur's API in guild to get a Client ID, located here: https://api.imgur.com/oauth2/addclient , with the callback URL gear up as https://www.getpostman.com/oauth2/callback Press submit, and copy downwards the Client ID it gives you. Going back to DBM, create a new command to house this pain. For your kickoff action, make it Store Command Params with the source info as one param , param number of 1 , and a temp variable of search. The second action is where things become complicated. Brand a Run Script action with End Beliefs set as Do Not Phone call Next Activeness , Interpretation Style every bit either (don't recall information technology matters too much), and Store In to Nada . The script you demand in is this, and make you put your Customer ID nether var client_id !: var request = this.getWrexMods().crave("asking"); var url = "https://api.imgur.com/3/gallery/search/?q=" + tempVars("search"); var client_id = "<PUT YOUR CLIENT ID Here>"; var tempVarName = "imgur"; endeavour { asking.get({ url: url, json: true, headers: { 'Say-so': 'Client-ID ' + client_id } }, (err, res, data) => { if (err) { panel.error(err.stack ? err.stack : err); } this.storeValue(information, ane, tempVarName, cache); this.callNextAction(cache); }); } catch (err) { console.error(err.stack ? err.stack : err); } At present this is where things start getting easier. Make your 3rd action a Generate Random Number activity. This is and then you don't go the same image every time yous call it. Set your Minimum Range to 0, Maximum Range to 60, and make it a Temp Variable named range. 4th action is really parsing the script. Create a Parse From Stored Json, setting End Beliefs to Telephone call Next Action Automatically, Stored JSON Variable Name to imgur, the JSON path to $.data[${tempVars("range")}].id, and store information technology in a Temp Variable named imgur_image. The fifth and final activeness is just a Transport Message, with the message of https://imgur.com/gallery/${tempVars("imgur_image")} inside. You tin send it to whatsoever yous want, and it doesn't need to be stored. And there you accept information technology! You can now search for images on Imgur! Hither's a show and tell: Skillful luck, have fun, and happy holidays!
In case your host doesn't like the mistake catching function of the script, hither it is without that. (Information technology wasn't letting me edit) var request = this.getWrexMods().require("request"); var url = "https://api.imgur.com/iii/gallery/search/?q=" + tempVars("search"); var client_id = "3ecf3733b8b0344"; var tempVarName = "imgur"; asking.get({ url: url, json: true, headers: { 'Authorization': 'Client-ID ' + client_id } }, (err, res, data) => { if (err) { console.error(err.stack ? err.stack : err); } this.storeValue(data, i, tempVarName, enshroud); this.callNextAction(cache); });
Ah, sad almost that. At the time of posting, information technology required that beta version but information technology looks like it's been updated.
this is all i continue getting when trying to search for an image. WrexMods: Could non automatically install request. (Install attempt limit reached) Please install it manually 'npm install request' before continuing. Installing Node Module: request and im not certain where to "install" what its telling me to
You demand to run your bot with node.js. But please switch to the mods server considering this is not related to the official support.
That's an error you'll occasionally get if the search can't find anything that fits your search term. Run the control again and you'll possibly get something. If you continue to get it you may be out of luck.
I would update it, unfortunately I tin can't really edit whatsoever of my posts rn. With the update to the mods as well, there may exist a better way to do it, only I am not sure.
0 Response to "Discord Bot How to Upload Images From Imgur Command Python"
Post a Comment