discord

Deleting a bot's message in discord.py

一世执手 提交于 2021-02-07 14:35:31
问题 I have already made all of the proper imports and I have tried looking for answers from other posts but it seems to not quite fit my issue. I am trying to randomly send a message, which I can do. However I can not seem to delete the messages after a certain cool down time. The cool down time is not the issue however. It is deleting the bots message. I know how to delete a user's message but I have very little idea on how I would delete the bots message. Any help would be nice. Here is my code

Deleting a bot's message in discord.py

自古美人都是妖i 提交于 2021-02-07 14:33:24
问题 I have already made all of the proper imports and I have tried looking for answers from other posts but it seems to not quite fit my issue. I am trying to randomly send a message, which I can do. However I can not seem to delete the messages after a certain cool down time. The cool down time is not the issue however. It is deleting the bots message. I know how to delete a user's message but I have very little idea on how I would delete the bots message. Any help would be nice. Here is my code

Discord.py how to invoke another command inside another one?

泄露秘密 提交于 2021-02-07 10:24:26
问题 I want my bot to play a specific song when typing +playtest using already defined function (+play) but i got an error says "Discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: 'Command' object is not callable" an entire code work perfectly fine except for this command i wonder does ctx.invoke enable passing arguments? or i just missed something here is my brief code import discord import wavelink from discord.ext import commands import asyncio from bs4

Discord.py how to invoke another command inside another one?

坚强是说给别人听的谎言 提交于 2021-02-07 10:22:26
问题 I want my bot to play a specific song when typing +playtest using already defined function (+play) but i got an error says "Discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: 'Command' object is not callable" an entire code work perfectly fine except for this command i wonder does ctx.invoke enable passing arguments? or i just missed something here is my brief code import discord import wavelink from discord.ext import commands import asyncio from bs4

Stop all Pods in a StatefulSet before scaling it up or down

老子叫甜甜 提交于 2021-02-07 07:39:49
问题 My team is currently working on migrating a Discord chat bot to Kubernetes. We plan on using a StatefulSet for the main bot service, as each Shard (pod) should only have a single connection to the Gateway. Whenever a shard connects to said Gateway, it tells it its ID (in our case the pod's ordinal index) and how many shards we are running in total (the amount of replicas in the StatefulSet). Having to tell the gateway the total number of shards means that in order to scale our StatefulSet up

How can I make a random response in Discord.js

和自甴很熟 提交于 2021-02-05 11:56:19
问题 The title explains it I guess. I have no code written down and it would be nice if someone explains the steps to the code. I want it to send a random link for a wallpaper from a website each time the command 'a wallpaper' is used. Any helpers? 回答1: client.on('message', (message) => { if (message.content.startsWith('!wallpaper')) { // Here you can choose between creating your array with your own links or use a api that will generate it for you. For now i'll use an array const wallpapers = [

How can I make a random response in Discord.js

烈酒焚心 提交于 2021-02-05 11:56:11
问题 The title explains it I guess. I have no code written down and it would be nice if someone explains the steps to the code. I want it to send a random link for a wallpaper from a website each time the command 'a wallpaper' is used. Any helpers? 回答1: client.on('message', (message) => { if (message.content.startsWith('!wallpaper')) { // Here you can choose between creating your array with your own links or use a api that will generate it for you. For now i'll use an array const wallpapers = [

AttributeError: 'Bot' object has no attribute 'add_roles'

那年仲夏 提交于 2021-02-05 11:29:35
问题 I am writing a bot for discord in Python. I want that when someone logged in to the server, he was given a certain role import discord from discord.ext import commands from discord.ext.commands import bot bot = commands.Bot(command_prefix='!') from discord.utils import get @bot.event async def on_member_join(member): role = get(member.roles, name="Игроки") await bot.add_roles(member, role) When I start and someone enters the server, I get the following error: AttributeError: 'Bot' object has

Sending message every minute in discord.py

巧了我就是萌 提交于 2021-02-05 09:44:44
问题 I am trying to make the bot send a message every minute in discord.py. I do acknowledge that this is a easy thing to do but I have tried multiple times but resulting with no luck. I have not gotten any error messages. Here is my code: import discord from discord.ext import tasks client = discord.Client() @tasks.loop(minutes=1) async def test(): channel = client.get_channel(CHANNEL_ID) channel.send("test") test.start() client.run(TOKEN) 回答1: You try to get channel with get_channel() , but your

Sending message every minute in discord.py

会有一股神秘感。 提交于 2021-02-05 09:44:07
问题 I am trying to make the bot send a message every minute in discord.py. I do acknowledge that this is a easy thing to do but I have tried multiple times but resulting with no luck. I have not gotten any error messages. Here is my code: import discord from discord.ext import tasks client = discord.Client() @tasks.loop(minutes=1) async def test(): channel = client.get_channel(CHANNEL_ID) channel.send("test") test.start() client.run(TOKEN) 回答1: You try to get channel with get_channel() , but your