#!/usr/bin/python3 # -*- coding: utf-8 -*- import amongus client = amongus.Client(name="Bot") @client.event async def on_ready(): print("Connected!") await client.join_lobby("ABCDEF") @client.event async def on_game_join(lobby_code: str): print(f"Joined game lobby '{lobby_code}'") @client.event async def on_chat(message: str, sender: amongus.Player): print(f"[Chat] {sender.name}: {message}") if message == "stop": await client.stop() elif message == "source": await client.send_chat("https://gitlab.com/TECHNOFAB/AmongUsIO") elif message == "ping": await client.send_chat(f"Pong! Latency: {client.latency}ms") else: # echo back await client.send_chat(message)
#!/usr/bin/python3 # -*- coding: utf-8 -*- import amongus client = amongus.Client(name="Bot", spectator=True) # we can still receive all kinds of things other players do, like movement, chatting, # maybe even killing. But as were in a state between existing and not we cannot send # any commands to control our "player" (which is invisible/non-existent) @client.event async def on_ready(): print("Connected!") await client.join_lobby("ABCDEF") @client.event async def on_game_join(lobby_code: str): print(f"Joined game lobby '{lobby_code}'") @client.event async def on_chat(message: str, sender: amongus.Player): print(f"[Chat] {sender.name}: {message}") # as were in spectator mode we cant answer, only read/receive # if you still wanna try chatting you'll be greeted by a SpectatorException :) await client.send_chat(message) client.run(region="EU") # or, for a custom server:
#!/usr/bin/python3 # -*- coding: utf-8 -*- import amongus from amongus.enums import PlayerAttributes client = amongus.Client( name="Bot", color=PlayerAttributes.Color.Black, hat=PlayerAttributes.Hat.Geoff_Keighley_Mask, skin=PlayerAttributes.Skin.Astronaut, pet=PlayerAttributes.Pet.Robot, ) @client.event async def on_ready(): print("Connected!") await client.join_lobby("ABCDEF") client.run(region="EU") # or, for a custom server: client.run( custom_server="your.server.ip:port") # port is optional, default is 22023