Editing Discord bot to accept another bot's commands - python

I want to make my Discord bot able to respond to another bot's commands. So the other bots can use my bot. What can I do to do this for specific commands? What should I add to this? Thanks for all your help.
#bot.command()
async def dothat(ctx):
await ctx.send("!blabla")

this is not possible on discord.py only in discord.js and discord.jda

Other bots will probably block bots from contacting it, as it's policy on several discord listing sites (such as top.gg). By default however, other bots can contact other bots.
Bots can detect whether its a bot contacting it through the use of
ctx.message.author.bot
which is a boolean that is true when the author of the message is a bot.

Related

Is it possible for my discord bot to add another bot to its server?

I have two working discord bots and a test server. I want my first bot to add the second bot to the test server. How would I go about this? I have researched it and found nothing. Any help would be appreciated. Thanks!
This isn’t possible, bots can’t run other bots cmds or add other bots to a server.

Detect when Discord bot was authorized on server

Just started to implement a simple bot for Discord.
All goes well but I just cannot find an info on how to detect when bot was authorized on some server.
I mean when somebody use OAuth2 link provided in Discord developer portal to add my bot to a server.
How can I get ID of this server? Is there some event for that?
Thanks.
You can detect the event when your bot joins a guild using the on_guild_join() event: (ref: https://discordpy.readthedocs.io/en/stable/api.html#discord.Client.guilds)
#client.event
def on_guild_join(guild):
# Do something
You can always get the list of guilds your bot is in by using client.guilds (ref: https://discordpy.readthedocs.io/en/stable/api.html#discord.Client.guilds) Note that you require permissions to access this event.

How can I post a comment with Discord.py without the use of events?

I'm writting a Discord bot with Discord.py. What I am trying to write is a bot that grabs a picture from reddit, saves the image id in Discord and posts the image to twitter. I use Discord because I am hosting the bot with Heroku and it does not allow to save images or text files. I thought it was a clever way to keep track of the images that the bot picks by posting the images id in a private Discord server
My problem is that every time Heroku restarts the bot I need to post a command on Discord to make it start again. I think there should be some way to avoid this but after reading the Discord.py docs I could not find any solution that allows to read and print comments on Discord without the use of events that require manual inputs.
If you bind your code to a command, obviously you always need to call this command after the bot restartet.
Use the on_ready() event to call your code everytime your bot starts:
#client.event
async def on_ready():
# CODE
channel = await client.fetch_channel(YOUR_CHANNEL_ID)
await channel.send(OUTPUT)

Set Discord User to AFK in python

i have a discord bot written in python and it uses a users discord auth token. When th program is running it wont send any mobile notifications because it makes discord think im online and wont go afk for the afk timer to kick on. Is there a way to use the auth token and not have discord think im logged in? or is there a way to make discord think the user is afk? any help would be gratly appreciated!!
Use Client.change_presence()
await bot.change_presence(status = discord.Status.idle)
Here are the different kinds of Status available.

Is it possible to create a telegram bot which forwards messages from another bot to telegram group or channel?

I want to create a telegram bot which would immediately forward message from another bot, that regularly posts some info. I've tried to find some ready templates, but alas... I would be grateful for any useful info. Thanks!
I don't think this is possible. As far as I know, bots can't communicate with other bots.
But you can add bots to groups

Categories

Resources