· 5 years ago · May 06, 2020, 09:44 AM
1import requests
2import json
3
4##These are your variables, this is where you place your options for what you wanna
5##do as well as edit them for future use, without accidently messing up the network request
6
7c = "chat" ##This is the variable c, which equals "chat", and is
8 ##what the api calls our dms
9
10og = "opengroup" ##This is the variable og, which equals "openchat", and is
11 ##what we call a public groupchat
12
13
14g = "group" ##This is the variable g, which equals "group" and is
15 ##what we call a private group chat
16
17
18sessionkey = "place sessionkey here" ##your session key allows you to access all things
19 ##sendbird api, its what i use in the pfp and color command
20
21chat_url = "place chat url here" ##This is the variable for chaturl, which is used to determine
22 ##where you want to send the network request too
23
24headers = {"Session-Key": sessionkey} ##This is essentially your password to sendbird api, it lets you in
25
26
27url = f"https://api-us-1.sendbird.com/v3/group_channels/{chat_url}" ##This chooses where the request goes
28payload = {"custom_type": } ##Place g, c, or og, in after "payload = {"custom_type": ", this decides what you
29 ##want the new channel type to be
30r = requests.put(url, data=json.dumps(payload), headers=headers) #This combines all the info together and sends a network request
31
32print(r) ##this isnt required, but prints the status of the network request to the api