Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add setGlobalname and setPronoun functions #484

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions discum/discum.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,14 @@ def setProfileColor(self, color=None):
#set username
def setUsername(self, username): #USER PASSWORD NEEDS TO BE SET BEFORE THIS IS RUN
return imports.User(self.discord, self.s, self.log).setUsername(username, password=self.__user_password)

#set globalname
def setGlobalname(self, username):
return imports.User(self.discord, self.s, self.log).setGlobalname(username)

#set pronoun
def setPronoun(self, pronoun):
return imports.User(self.discord, self.s, self.log).setPronoun(pronoun)

#set email
def setEmail(self, email): #USER PASSWORD NEEDS TO BE SET BEFORE THIS IS RUN
Expand Down
10 changes: 10 additions & 0 deletions discum/user/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,16 @@ def setUserNote(self, userID, note):
url = self.discord+'users/@me/notes/'+userID
body = {"note": note}
return Wrapper.sendRequest(self.s, 'put', url, body, log=self.log)

def setGlobalname(self, name):
url = self.discord+"users/@me"
body = {"global_name": name}
return Wrapper.sendRequest(self.s, 'patch', url, body, log=self.log)

def setPronoun(self, pronoun):
url = self.discord+"users/@me"
body = {"pronouns": pronoun}
return Wrapper.sendRequest(self.s, 'patch', url, body, log=self.log)

def getRTCregions(self):
url = "https://latency.discord.media/rtc"
Expand Down
2 changes: 2 additions & 0 deletions docs/using.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ Table of Contents
- [get RTC regions](using/REST_Actions.md#getrtcregions)
- [get voice regions](using/REST_Actions.md#getVoiceRegions)
- [change username](using/REST_Actions.md#setusername)
- [change global name](using/REST_Actions.md#setGlobalname)
- [change pronoun](using/REST_Actions.md#setPronoun)
- [change email](using/REST_Actions.md#setemail)
- [change password](using/REST_Actions.md#setpassword)
- [change discriminator](using/REST_Actions.md#setdiscriminator)
Expand Down
14 changes: 14 additions & 0 deletions docs/using/REST_Actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,20 @@ bot.setUsername('helloworld')
###### Parameters:
- new username (str)

##### ```setGlobalname```
```python
bot.setGlobalname('new global name')
```
###### Parameters:
- new global name (str)

##### ```setPronoun```
```python
bot.setPronoun('he/she/it')
```
###### Parameters:
- new pronoun (str)

##### ```setEmail```
\*bot.\_Client\_\_user\_password needs to be set before running this
```python
Expand Down