#(Behr) Counting a string in text

83 messages · Page 1 of 1 (latest)

midnight acorn
#

Is there a tag that "counts how many times a value appears in an elementtag"?
eg, lasagna would have the letter a three times,
and my lasagna named lasagna loves lasagna would have lasagna three times
ooor do i have to .split[lasagna].size and check that way?

worldly fernBOT
#

Hi I'm AutoThreadBot! Don't mind me, I'll just be adding the helper team to this thread so they can see it. A human will get to you soon.
You can block this bot if you don't want to see these messages, I won't mind.
<@&525394568410038282>

midnight acorn
#

i can't always rely on it being one character or space separated either, or i'd use to_list or space_separated

snow yarrow
#

thats... interesting, after getting list of those elements you could use listtag.count[] tho

naive wagon
#

your solution there seems competent

#

it'd get more complex if you needed to actually do anything with the element

#

@ocean mist <element[my lasagna named lasagna loves lasagna].split[lasagna].size>

ocean mistBOT
midnight acorn
#

the split[thing].size just needs to be split[thing].size.sub[1] and that works i guess lol

#

unless uh

naive wagon
#

why

#

lasagna appeared 3 times there

midnight acorn
#

i just realized your example is different than what im working with

ocean mistBOT
midnight acorn
#

if it has any text after it, it needs -1

naive wagon
#

@ocean mist <element[hi hello hi huh let'shi see].split[hi].size>

ocean mistBOT
naive wagon
#

ah

ocean mistBOT
midnight acorn
#

oh, and if text before

ocean mistBOT
little ether
#

?

midnight acorn
#

that's space split

#

i wont actually have spaces in my usage, im splitting by crazy strings lol

naive wagon
#

@ocean mist <element[hi hello hi huh let'shi see].split.count[hi]>

ocean mistBOT
naive wagon
#

doesn't work

little ether
#

this is vague like a rague

midnight acorn
naive wagon
#

bruh

#

is this a helper xy

little ether
#

yes

midnight acorn
#

im replacing span class="meta_url">ObjectType</span><a href=" in

Sends a message to a Discord channel.
Command may fail if the bot does not have permission within the Discord group to send a message in that channel.
You can send the message to: a channel, user, or in reply to a previous message.

If sending as a reply, optionally use "no_mention" to disable the default reply pinging the original user.
Channels can be specified as either a copied ID, or using any tag that returns a valid DiscordChannelTag.

To get IDs, enable "Developer Mode" in your Discord settings, then right click on the channel and press "Copy ID".
You can edit an existing message by using "edit:<message>".
You can use "attach_file_name:<name>" and "attach_file_text:<text>" to attach a text file with longer content than a normal message allows.
You can use "rows" to attach action rows of components, such as buttons to the message, using <span class="meta_url">ObjectType</span><a href="/Docs/ObjectTypes/DiscordButtonTag">DiscordButtonTag</a>, and <span class="meta_url">ObjectType</span><a 
        href="/Docs/ObjectTypes/DiscordSelectionTag">DiscordSelectionTag</a>.
The command can be ~waited for. See <span class="meta_url">Language:</span><a href="/Docs/Languages/~waitable">~waitable</a>.```
#

lmfao

little ether
#

why

#

I'm still a little confused of your end goal

#

but uh,

#

!t element.replace_text

plain epochBOT
little ether
#

That should do?

#

!t replace_text.with

plain epochBOT
midnight acorn
#

it does

#

!c discordmessage

plain epochBOT
# midnight acorn !c discordmessage
Required Plugins or Platforms

dDiscordBot

Group

external

Syntax

discordmessage (id:<id>) [reply:<message>/edit:<message>/channel:<channel>/user:<user>] (<message>) (no_mention) (rows:<rows>) (embed:<embed>|...) (attach_files:<map>)

Short Description

Sends a message to a Discord channel.

Description

Sends a message to a Discord channel.

Command may fail if the bot does not have permission within the Discord group to send a message in that channel.

You can send the message to: a channel, user, or in reply to a previous message.
If sending as a reply, optionally use "no_mention" to disable the default reply pinging the original user.

Channels can be specified as either a copied ID, or using any tag that returns a valid DiscordChannelTag.
To get IDs, enable "Developer Mode" in your Discord ...

midnight acorn
#

there's two object links in this description

#

to get the name of each one, i have to use element manipulation to get discordbutton and discordselection

#

i dont want to use regex though

#

it kills the queuespeed

little ether
#

Do you haaaave more background info?

#

Because you could just ``.split[/Docs/ObjectTypes]>and then.after[/].before["]` on both entries of the list

midnight acorn
#

it's for two different projects, it's half for my sparklies custom meta command script
and the other half is for my website fancy colorizer

midnight acorn
# little ether Because you could just ``.split[/Docs/ObjectTypes]>` and then `.after[/].before[...

this is close, but it can't work because of this example:
if <[text]> is:

. . . . . . . . .
. . . . axb . . .
. . . . . . ayb .
. . . . . . . . .```

if i want x to have a fancy a and b, i can't just do:

- foreach x|y as:string:
  - define text <[text].after[a].before[b]>
  - define text <[text].replace_text[a<[string]>b].with[-a-<[string]>-b-]>

because the second loop will fill my first tag <[text].after[a].before[b]> with -<[string]>- and not <[string]>
i have to grab x and y and then replace them after or replace the whole thing exactly once

#

i also need to save a few different parts of that so i can format stuff the way i want for both projects

little ether
#

What's the outcome you wish for?

midnight acorn
#

this but not broken on the DiscordSelectionTag link, i just have to finish writing it kekw_dog i had to add the repeat to get to the second one

little ether
#

oooo

#

!paste

plain epochBOT
little ether
#

Wanna post ya current scripty script

midnight acorn
#

depends on if you want to puke or not badlaugh

#

it is not clean at all and i planned on doing that waaay later LMAO

#

would either need to rename this thread or start a new one if you wanted to do that too, cause i think i have what i wanted tag-wise lol

little ether
#

I still have a question, why don't you just use metabot

#

on ya serv?

midnight acorn
#

!c discordmessage usage

plain epochBOT
# midnight acorn !c discordmessage usage
Required Plugins or Platforms

dDiscordBot

Group

external

Syntax

discordmessage (id:<id>) [reply:<message>/edit:<message>/channel:<channel>/user:<user>] (<message>) (no_mention) (rows:<rows>) (embed:<embed>|...) (attach_files:<map>)

Short Description

Sends a message to a Discord channel.

Use to message a Discord channel with a copied channel ID.
- discordmessage id:mybot channel:1234 "Hello world!"
Use to reply to a message from a message received event.
- discordmessage id:mybot reply:<context.message> "Hello world!"
Use to message an embed to a Discord channel.
- discordmessage id:mybot channel:1234 embed:<discord_embed[title=hi;description=this is an embed!]>
Use to message a Discord channel and record the new message ID.
- ~discordmessage id:mybot channel:1234 "Hello world!" save:sent
- announce "Sent as <entry[sent].message.id>"
Use to send a message to a user through a private channel.
- discordmessage id:mybot user:<[user]> "Hello world!"
Additional Usage Examples

... and 5 more.

midnight acorn
#

fack

#

because ive completely buried my chat with that alone

#

but i can at least breathe with this less space

#

my little x even deletes the message + my !c command

#

and cause this is pretty nailpolish

#

there's not a good reason

#

she's beautiful happysmile

#

lmk if you want to see that script though, it's just under serious baggage as a fair warning lol