im trying to make a 8ball embed discord.js - embed

In the console it says Argument expression expected how do i fix this? Here is my code https://hastebin.com/imaqulixer.js

You have to set in your embed description:
returns[nr]
Please tell us next time your error that you have.
And please use message.channel.send({embed:embed}) instead of the deprecated .sendEmbed function

From what I can tell, you are having problems because you are trying to define your 'nr' variable inside the embed. Simply replace .setDescription(var nr = Math.floor(Math.random()*returns.length) with .setDescription(nr), because you already defined nr earlier in your code.

Related

ngStyle Problem with receiving colors from an object/model

I have designed a special shape with html/Css and I want to receive its color from a data service.
[ngStyle]="{'background-color':'#0B0036'}"
when I use this code, everything works fine. but as soon as I try this:
[ngStyle]="{'background-color':'{{Card.lesson.color}}'}" (with or without quote)
or
[ngStyle]="{'background-color':'Card.lesson.color'}"
I either get errors or don't get any color at all.
what is the correct way to write that syntax?
The correct syntax is:
[ngStyle]="{'background-color': Card.lesson.color }"
You are binding an expression into your template, not a string.
See the docs for more details

What would be the xpath file I can create for the following href: 00730073?

I'm new to using xpath statements. Using the following href:
00730073
How would I write the xpath?
I'm using Xpath Helper and when I use the following xpath:
//a[contains(#href,'8000')]
Its returning the incorrect results. I was expecting '00730073', but I'm getting '00730075'
Using ID as your locator is usually your safest bet, since it is always going to be a unique match.
//a[#id="8000j0000000XlzAAE"]
But you could also access it by the text (hyperlink):
//a[text()="00730073"];
or finally, you could access it by the href itself:
//a[#href="/8000j0000000XlzAAE"]
The text and href are more likely to change over time, and thus break your script, so that's another reason to use ID whenever available. That can change too, but it rarely does.
Please try :
Using text of link
"//a[contains(.,'00730073')]";
I hope it will help you.

Gmod Lua Coding - How to place an HTML5 Page (Website) Inside of a Box

I've been working with a friend and we both have a problem, in a Garry's Mod Server, ok so we have a box saying Rules, and when we go to place a website INSIDE OF THAT BOX, it shows exactly this:
http://cloud-4.steamusercontent.com/ugc/37489242708029141/B4E51CC2F089F13DF25AA8F4F3E9BF7A07619427/
As you can see, it shows a box with the HTML5 coding, not sure if I can place:
http://www.sparkperp.com/Rules/index.html on that box.
I would like to know how to do that, if it's possible.
Thanks for your help
Please give your code in the future. Since I'm unable to view your code I'm limited in how much I can help, but I will try my best anyway!
You need to use the HTML vgui element vgui.Create("HTML") and use :OpenURL(weblink) on it. You can also use :SetHTML(htmlstring) if required. You should get the idea from the below code block:
local MOTD = vgui.Create( "HTML", parent )
MOTD:OpenURL("http://www.sparkperp.com/Rules/index.html")
If you can't get it working, update your question with your code and I'll be able to help further.

Umbraco Contour displaying ampersand (&) as & in questions

I've recently installed Contour for a client and in one of the questions in the form there's an ampersand (&) but its rendering as &
I've tried rendering the form both in RTE and via the template itself but still the same result.
The client is running Umbraco v4.7.2 and Contour v3.0.6
Thanks in advance
Let me try a few suggestions in hopes that you can let us know what you are experiencing...
On the template are you using an inline macro (i.e. - calling the content using #Model.bodyContent) or,
Are you calling the umbraco field with <umbraco:Item field="bodyContent" runat="server" />
If you are calling the value from within a macro, try wrapping the output in #Html.Raw(bodyContent)
Secondly, try using the form picker datatype that comes with Contour. Add it to your doctype and render the form using the RenderMacroContent method. If you need the full script to get this working let me know in reply, but this link (https://our.umbraco.org/wiki/reference/umbracolibrary/rendermacrocontent) should help.
Finally, check the contour files and edit the ContourForm.cshtml file. Try using #Html.Raw() around the #f.Caption output within the <label> tag.
It is hard to be too specific without some additional clues and troubleshooting, but this is where I would start. Any additional information you can provide will allow me to edit my answer and provide more assistance.

Using simple Razor code inside JavaScript

I'm using Visual Studio 2012 RC with ASP.NET MVC 4. This is driving me crazy, and I know this has been asked several times, but I can't find a solution for MVC 4, and no unified solution for MVC 3. I must be missing something...
All I want to do is output a c# variable in a block of javascript. This should be trivial, and is a necessity to be able to do, but despite all of the workaround/hacks I've tried, nothing will get rid of the "Conditional compilation is turned off " error. This would be fine if it was just a warning, but it's an error. If I close the view inside of visual studio it compiles and works fine, but if it's open I can't even compile, and that isn't acceptable.
I've tried using /*#cc_on #*/ and /*#("#cc_on #")*/ to turn conditional compilation on to no avail. Doing #(serverVar) gives an invalid character error (#). I've also tried #Html.Raw and several other things.
The only way I include razor code without an error is if the razor code is inside quotes, which works well for strings, but not for int and bool.
#{
int serverVar = 5;
}
<script>
var obj = { jsVar: #serverVar };
</script>
I've searched everywhere for this, and can't find an agreed upon solution. Am I missing something? Any help is greatly appreciated.
Use JavaScriptModel ( http://jsm.codeplex.com )
This way you can transfer easily server-side variables to javascript without annoying inline javascript.
You would just have to write the following code in your controller action:
this.AddJavaScriptVariable("VariableNameInJavaScript", serverVar);
If you want several variables to be set on every page use a filter like it's documented here:
http://jsm.codeplex.com/wikipage?title=Use%20JavaScriptModel%20in%20a%20global%20filter&referringTitle=Documentation
Edit:
If you have a lot of variables, you should categorize them and Add them in different literals.
E.g.
this.AddJavaScriptVariables("Config.UserId", userId,
"Config.SomeOtherConfig", someOtherConfigValue,
"MyGoogleMapController.Pushpins", GetMapPushpins());
Umm I guess there is no way to get rid of this error, and since it still compiles everything is just fantastic.
I solved it by using below trick.
var supportedNumber = Number(#TempData["supportedNumber"]);