This repository was archived by the owner on Mar 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathexample.py
More file actions
56 lines (40 loc) · 1.31 KB
/
Copy pathexample.py
File metadata and controls
56 lines (40 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import os
import asyncio
import pytgcalls
import pyrogram
# EDIT VALUES!
API_HASH = None
API_ID = None
CHAT_ID = '@tgcallschat'
INPUT_FILENAME = 'input.raw'
OUTPUT_FILENAME = 'output.raw'
async def main(client):
await client.start()
while not client.is_connected:
await asyncio.sleep(1)
# you can pass init filenames in the constructor
group_call = pytgcalls.GroupCall(client, INPUT_FILENAME, OUTPUT_FILENAME)
await group_call.start(CHAT_ID)
# to change audio file you can do this:
# group_call.input_filename = 'input2.raw'
# to change output file:
# group_call.output_filename = 'output2.raw'
# to restart play from start:
# group_call.restart_playout()
# to stop play:
# group_call.stop_playout()
# same with output (recording)
# .restart_recording, .stop_output
# to send speaking status you can use this:
# group_call.send_speaking_group_call_action()
# to mute yourself:
# group_call.set_is_mute(True)
await pyrogram.idle()
if __name__ == '__main__':
pyro_client = pyrogram.Client(
os.environ.get('SESSION_NAME', 'pytgcalls'),
api_hash=os.environ.get('API_HASH', API_HASH),
api_id=os.environ.get('API_ID', API_ID)
)
loop = asyncio.get_event_loop()
loop.run_until_complete(main(pyro_client))