

run ( token, *, reconnect = True, log_handler =. TypeError – An unexpected keyword argument was received. Invalid sharding payloads or bad tokens). ParametersĪnything as the library will do it for you. await start ( token, *, reconnect = True ) ¶Ī shorthand coroutine for login() + connect(). is_closed()Īnd is_ready() both return False along with the bot’s internalĬache cleared. clear ( ) ¶Īfter this, the bot can be considered “re-opened”, i.e. Is thrown then there is a Discord API outage.ĬonnectionClosed – The websocket connection has been terminated.Ĭloses the connection to Discord. GatewayNotFound – If the gateway to connect to Discord is not found. Certainĭisconnects that lead to bad state will not be handled (such as Reconnect ( bool) – If we should attempt reconnecting, either due to internetįailure or a specific failure on Discord’s part. Is not resumed until the WebSocket connection is terminated.

This is a loop that runs the entireĮvent system and miscellaneous aspects of the library. Usually when it isn’t 200 or the known incorrect credentialsĬreates a websocket connection and lets the websocket listen HTTPException – An unknown HTTP related error occurred, LoginFailure – The wrong credentials are passed. Do not prefix this token withĪnything as the library will do it for you. Logs in the client with the specified credentials and

This class is used to interact with the Discord WebSocket and API. Represents a client connection that connects to Discord. Therefore one frame will be 4-bytes long.The following section outlines the API of discord.py.Ĭlass discord. In our case we have two channels (stereo sound) so one frame of out output will be represented by a pair of integers, each coded on 16 bits (2 bytes). Now you just have to read the output of FFMPEG. It can be omitted most of the time in Python 2 but not in Python 3 where its default value is pretty small. In sp.Popen, the bufsize parameter must be bigger than the biggest chunk of data that you will want to read (see below). The - at the end tells FFMPEG that it is being used with a pipe by another program. In the code above -i mySong.mp3 indicates the input file, while s16le/pcm_s16le asks for a raw 16-bit sound output. Import subprocess as sp command = pipe = sp.
