How to set copy option on discord bot button? - discord

I want to give my discord bot feature to shorten URL. I want to give it a button option which will copy the shortened URL to users clipboard. How do I implement the feature using ButtonBuilder?

You can not make a user copy a string using a button. What you can do is redirect the user to a web page you built, that contains a copy button.
For example, your button will redirect users to https://your-website.com?copy=https://google.com. where copy value is the shortened URL.
your-website.com (that you will create) will take the copy url parameter and show a button to copy the it.

Related

Download PDF in React

I'm working on an api which returns a PDF link. I can put that link into a button, and when users click on that link, it'll download a PDF to their computer. I wonder if there is a way, so that when users click on the link the first time, it'll download the file. But if they click on the link the second time, it just opens a modal with the PDF content inside of it? That way they don't have to download the file again and again.
It's confidential so I can't tell how the link look like, but it's a PDF link stored in s3 aws.
You can do it but you need to store the information that if the user clicked the button before or not. The options for storing that information is:
Local Storage
Cookie
Your backend
I would suggest not to involve your backend on this, you can just write to localStorage when user clicks that link for the first time and set something like pdfDownloadedPreviously. If you have multiple pdfs like this, you would need to define a unique key for each of them so they don't override each other.
And in your program logic, you can read this from the localStorage, if that key exists in the localStorage then you open your modal, otherwise download.

Adding custom action buttons to Wagtail Admin

In Wagtail, I currently have content which I wish to update based on API calls to another website:
I have a VideoPage with fields like url, title and description. When adding a VideoPage I'd like to be able to enter just the url , click a button, and it'll try to prepopulate the other fields by making API calls (via either the front end or back end)
I also have a ChannelPage, which VideoPages are children of. I'd ideally like a way to click a button in admin, have my server check whether the channel has new videos, then create new VideoPage children accordingly.
From the above use cases, I believe my problem comes down to this: is it possible to add standalone action buttons to the admin area for a Page which, when clicked, allows the backend to edit fields, create new pages, etc. accordingly?

AngularJS optional login

I'm trying to figure out a way to make logging in optional. So basically, I still want to keep the existing access option with user login id and password, but also another option that the user can click on a link that takes them directly to the page without having to log in.
Is there a way to do this with AngularJS?

Redirect to Angular app

I tried google to search the answer but may be I am not asking the correct question.
My Scneario is, I have an angular app(APP1) with a grid. The grid has a link in one of its cell which points to an external asp.net web application(APP2). When the user clicks on the link he/she will be navigated to APP2, where they will perform some actions. Once done the user will click a button on APP2 which will save the data and generate an ID and Navigate back to APP1(angular app).I need to get hold of this id that is returned from APP2 and do some operations in APP1.
Let me know if its not clear what I am trying to do.
App1(angular)->App2/someparameter(asp.net webform app)->App1/id(angular)
How can I achieve this?

Webform: how to set confirmation message

I'm trying to set a confirmation message on my webform.
I'm using the standard redirect to confirmation page option when a form is submitted.
I clicked every single link in my webform backend and can't find it anywhere. All search results regarding this issue lead to programming a custom module to display a confirmation message in a popup or redirect to a different confirmation page. I don't want to do any of that, just a simple edit of the standard confirmation message.
I've looked through the webform-confirmation.tpl.php file in the module and see that it just prints a $confirmation_message variable. I don't want to edit it there as I want to be able to translate the string in the drupal admin section.
Surely this must be available somewhere?
When you edit the webform there are four tabs at top right side: Display, Edit, Webform and Results (look at screenshot: https://dl.dropboxusercontent.com/u/207644/screenshot-webform.jpg). Click on Webform tab. If you don't see this tab you have problem with user rights maybe.
On Webform tab are 3 subtabs: Form components, E-mails and Form settings. You must click on third - Form settings. Finally there is section "Submission settings" where you can setup confirmation message.

Resources