alejandro5042/Run-IrcBot

[Question] Can you use an IRC message text as a variable?

Closed this issue · 4 comments

EX:

param ($Message, $Bot)

switch -regex ($Message.Text)
{
    "This is a variable"   { storeasvariable }
    "Say Variable" {$Variable}**
}

@alejandro5042 I'm confused, it seems that the section that you pointed me to says how to use and preserve variables but not how to store messages as variables.
Thank you for your response.

Can't you simply store $Message.Text in a $Bot.State.PreviousMessageText variable?

Do you want to capture a variable and output it later? This should work: (disclaimer: didn't test)

'This is a variable: (?<value>.*)' { $Bot.State.Variable = $Matches.value }
'print var' { $Bot.State.Variable }