How to transfer a discord server ownership with a bot - discord

There is any way of transfering a discord server ownership with a bot?
I have beed told that there is a way to do this with a python bot but I didn't figure out how.

It seems that a method exists on the discord.js wrapper. .setOwner()
I couldn't find a way to see if it really works. ^^
// Edit the guild owner
guild.setOwner(guild.members.cache.first())
.then(updated => console.log(`Updated the guild owner to ${updated.owner.displayName}`))
.catch(console.error);

you can actually change server ownership with a bot. but the bot must be the owner of the server before hand.
for a bot to create a guild it must use POST /guilds
to change owners you must use PATCH /guilds/{guild.id} and send over the json parameter owner_id with the id you want to transfer ownership too.
Offical Discord Documentation Links:
https://discordapp.com/developers/docs/resources/guild#create-guild
https://discordapp.com/developers/docs/resources/guild#modify-guild

Related

Discord.js integration role to bot

Hi everyone i am trying to code my own bot but i don't know to set these auto intergrated roles like this one,can someone explain me how they did this.enter image description here
Bots automatically create their own role with customised permissions(in the invite), the role cannot be added to other users.
When I add a bot to my server, a role is automatically created that is named like the bot.
I don't know if the message in the screenshot is exactly from this, but I can't add members to this bot role or edit it, only the bot has it and can have it.

Discord bot get user id by only name

So I'm currently making a bot that should dm users who entered their discord name(example#0000) outside of discord, I now need the bot to convert their names into their Id's, in order to dm them.
Is that even possible?
For clarification, the bot is not on the same server as the users and has never interacted with them.
No, it’s not possible to get a User/Member instance by name if you don’t share a guild, the only possible way would be to fetch it from the API using an ID
user = await bot.fetch_user(123345567901)

How to make a discord bot to auto send messages?

Is it possible to make a bot to automatically message people in my friends list or everyone from a specific server where i'm not an administrator? Where would i start, i know some Python but never worked with Discord bots, i was thinking this shouldn't be too hard as a first one?
I know i've received various messages / adveritsements from people on discord that i wouldn't think are admin on any server i'm on. Unless its done manually?
If you are wanting to write your own Discord bot in python, have a look at discord.py, follow the tutorial which will show you how to write simple commands and automated responses.
Is it possible to make a bot to automatically message people in my friends list or everyone from a specific server where i'm not an administrator?
You must have the required permissions to add the bot to the discord server. A role with 'regular' permissions will typically not allow you to do this. Additionally you can only have discord bots bound to a server, so a 'personal' bot that follows you around different servers is not really feasible.
I think what you're talking about is a self bot, which is against the Discord TOS and will likely get your account banned. If you want to get a bot on a Discord Server you'll have to ask an administrator.

How can I make my bot read custom status?

Hey I was just wondering if its possible to make my bot read users custom status so if it matches it gives the a role, By this I mean If they have my discord server invite link they recieve the supporter role is that possible?
Check the User#Presence part.
Then you can get their status and even their activity message.
To add a role to a member, make sure to check GuildMemberRoleManager#add.
Yes, that is possible.
It's included in the activities:
message.member.guild.presences.cache
This will return all the activities from all members in a guild.
Discord.js: https://discord.js.org/#/docs/main/stable/class/Presence?scrollTo=activities

Is it possible for a discord bot to enter a foreign server?

I'm using discord.js and I want to create a bot to retreive all the links of a certain channel, but I don't know if it's posible enter to a foreign server with the dicord api, for example join to this server https://discordapp.com/invite/C89qHyt.
Edited:
if it is posible, how I do that?
With a bot account, the client can't enter a server on its own. You have to use OAuth2 to invite the bot to the server. You'll also need the MANAGE_SERVER permission in the server you're trying to add the bot to.
To generate the invite link for your bot, this site may prove very useful.
you can't just add a bot to a group with no invite or permission.
You can't make it join. You have to create a invite link and let the server admin to invite it.

Resources