Giter Club home page Giter Club logo

Comments (6)

khoben avatar khoben commented on August 29, 2024

@mthsfurio
Use .env to store API_ID, API_HASH and other credentials, and mirror.config.yml to configure filters and directions:

# (Required) Mirror directions
directions:
  - from: [-1001, -1002, -1003]
    to: [-100203]

  - from: [-100226]
    to: [-1006, -1008]

# (Optional) Targets config
targets:
  - id: -100203
    filters:
      # Filter name with constructor parameters from telemirror.messagefilters module
      - SkipWithKeywordsFilter:
          keywords: !!set
            ? cat
            ? dog

from telemirror.

mthsfurio avatar mthsfurio commented on August 29, 2024

now work bro =/
even though I put the words in the same format as you did, the messages are still being sent

from telemirror.

mthsfurio avatar mthsfurio commented on August 29, 2024

mirror.config.yml:

# (Required) Mirror directions
directions:
  - from: [channel1]
    to: [channel2]


# (Optional) Targets config
targets:
  - id: channel1
    filters:
      # Filter name with constructor parameters from telemirror.messagefilters module
      - SkipWithKeywordsFilter:
          keywords: !!set
            ? word1
            ? word2
            ? word3

if channel1 contains a message with word1, word2 or word3, it is still arriving on channel2

from telemirror.

mthsfurio avatar mthsfurio commented on August 29, 2024

problem solved =)

only remove //b from te code

def __init__(self, keywords: set[str]) -> None:
        self._regex = re.compile(
            '|'.join([f'\\b{k}\\b' for k in keywords]), flags=re.IGNORECASE)

from telemirror.

khoben avatar khoben commented on August 29, 2024

problem solved =)

only remove //b from te code

def __init__(self, keywords: set[str]) -> None:
        self._regex = re.compile(
            '|'.join([f'\\b{k}\\b' for k in keywords]), flags=re.IGNORECASE)

Cool, but \bword\b means look for a single word, and without \b it will look for any substring containing "word".

from telemirror.

khoben avatar khoben commented on August 29, 2024

mirror.config.yml:

# (Required) Mirror directions
directions:
  - from: [channel1]
    to: [channel2]


# (Optional) Targets config
targets:
  - id: channel1
    filters:
      # Filter name with constructor parameters from telemirror.messagefilters module
      - SkipWithKeywordsFilter:
          keywords: !!set
            ? word1
            ? word2
            ? word3

if channel1 contains a message with word1, word2 or word3, it is still arriving on channel2

There is a slight misunderstanding here, the filters are set for the receiver channels (targets).
In the example targets.id should be equivalent to channel2.

from telemirror.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.