Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/santaspeen/triple-send

Send to Telegram, Vk, Discord
https://github.com/santaspeen/triple-send

discord python3 telegram vk

Last synced: 24 days ago
JSON representation

Send to Telegram, Vk, Discord

Awesome Lists containing this project

README

        

# Triple send


GitHub license
GitHub stars
magic



preview ds


preview vk


preview tg



##### Версия для русских: [здесь](./README_RU.md)

Demo:

* Telegram: @Triple_project_bot
* Discord: Triple project#0877
* Vkontakte: @dev.santaspeen

### How to run

* Install requirements
```shell
$ python3.9 -m pip install -r requirements.txt
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
...

```

```python
import triple

# default vk_api_version is 5.131
tr = triple.Triple(
vk_token="Token here", # Default None
tg_token="Token here", # Default None
ds_token="Token here", # Default None
prefix=".", # default '.'
config_path="./config/polling.json" # Default './config/polling.json'. This mean /config/polling.json'.
)

@tr.on_message("echo")
def bot_echo(event_type: str, event: triple.types.MessageObject):
""" example """

# Triggered from '.echo'

# Available event_types:
# tg_event
# vk_event
# ds_event

if event_type == "vk_event":
return f"Event type: {event_type}\n\nMessage: {event.text}\n\nEvent: {event!r}"

return f"Event type: `{event_type}`\n\nMessage: `{event.text}`\n\nEvent: `{event!r}`"

@tr.on_message(r"((?:\.help|/help|/start))", regex=True)
def bot_help(event_type: str, event: triple.types.MessageObject):

message = "Help:\n1: .echo {0}{0}"

if event_type == "vk_event":
return message.format("")

return message.format('`')

@tr.on_event
async def all_events(event_from: str, event):
print(event_from, event)

if __name__ == '__main__':
tr.run()
```

## Links

* [Author's Telegram](https://t.me/SantaSpeen "SantaSpeen"): https://t.me/SantaSpeen