discord

How to change a channels name using discord.py v.1.0.0a?

老子叫甜甜 提交于 2019-11-29 12:56:45
i've already searched a lot about this online. There I came across the API Refrence ( https://discordpy.readthedocs.io/en/rewrite/api.html#discord.TextChannel ) which kind of helped me finding what command I need to use. So my conculsion would be to use this code: channel = client.get_channel(475772135730708480) @client.command() async def emoivb(ctx): await discord.VoiceChannel.edit(channel, name = "test") the problem is that it doesnt work with this error: File "C:/Users/MyUser/Desktop/discordbot.py", line 25, in emoivb await discord.VoiceChannel.edit(channel, name = "test") So this error

Cooldown For Command On Discord Bot Python

孤者浪人 提交于 2019-11-29 12:31:23
@client.command(pass_context = True) async def getalt(ctx): msg = ["gabrielwarren2000@gmail.com:Cyber123", "leandroriveros123@gmail.com:culillo123", "albesi8@msn.com:Albakortoci1", "dryden6@yahoo.ca:toysale22", "nichlas00100@gmail.com:nich918273645", "lodevanveen@gmail.com:Lodelode1", "kylefielding2011@gmail.com:emolover123", "rubbst3in@gmail.com:rube541632789mk", "jasonfryckman@ymail.com:fryckman22", "NickSaya1@hotmail.com:blackout541", "devinquan@yahoo.com:ploopy101"] await client.send_message(ctx.message.author, random.choice(msg)) await client.send_message(ctx.message.channel, "Alt Has

Discord Add Guild Member 401 Error Despite Apparently Valid Access Token

点点圈 提交于 2019-11-29 11:37:45
I am new to Discord's API, and I am working a project which needs to be able to add a guild member programmatically. I've learned how to get an authorization code (with identify and guilds.join scopes), redeem it for an access token, and get a user's ID. The last step is to use the access code and user ID to add the guild. This command is detailed here: https://discordapp.com/developers/docs/resources/guild#add-guild-member It seems I need to send a PUT request to this URL: https://discordapp.com/api/guilds/[GuildID]/members/[UserID] But this results in this response: {"code": 0, "message":

discord.js bot replies to itself

自古美人都是妖i 提交于 2019-11-29 09:42:40
I am currently coding my first discord bot, it can already play YouTube music. if (message.content.includes("Good Job") || message.content.includes("good job")) { message.channel.sendMessage("Good Job everyone :smirk:"); } As you see, if someone types "good job" (this is just an example) then the bot will reply with "good job everyone :smirk:), but then the spam will begin: the bot reads his own message and replies to it. How can I prevent the bot from answering itself? Use this in the on message event: if (message.author.bot) return; for more info: https://anidiotsguide.gitbooks.io/discord-js

How can I send an embed via my Discord bot, w/python?

元气小坏坏 提交于 2019-11-29 08:33:44
I've been working a new Discord bot. I've learnt a few stuff,and, now, I'd like to make the things a little more custom. I've been trying to make the bot send embeds, instead, of a common message. embed=discord.Embed(title="Tile", description="Desc", color=0x00ff00) embed.add_field(name="Fiel1", value="hi", inline=False) embed.add_field(name="Field2", value="hi2", inline=False) await self.bot.say(embed=embed) When executing this code, I get the error that 'Embed' is not a valid member of the module 'discord'. All websites, show me this code, and I have no idea of any other way to send a embed.

How to join a server?

浪尽此生 提交于 2019-11-28 16:00:34
I'm trying to setup a discord bot with python. I have a pre-existing discord server that I would like the bot to join, but I'm having a hard time doing so. import discord import asyncio import logging logging.basicConfig(level=logging.INFO) client = discord.Client() @client.event async def on_ready(): print('Logged in as') print(client.user.name) print(client.user.id) print('------') print(client) @client.event async def on_message(message): print(message) if message.content.startswith('!test'): counter = 0 tmp = await client.send_message(message.channel, 'Calculating messages...') async for

FORBIDDEN (status code: 403) Can't send messages to this user

北战南征 提交于 2019-11-28 14:29:22
I want to make a command that will send a DM to the entire server, but I am getting the following error: Forbidden: FORBIDDEN (status code: 403) Can't send messages to this user What might be causing this? Here is my current code: @bot.command(pass_context=True) async def massdm(ctx, words*): output = " " for word in words: output += word output += "" server = ctx.message.server for member in server.members: await bot.send_message(member, output) The user might have blocked your bot or disabled DMs for your server, either way, you won’t be able to salvage the situation, so simply dropping the

How to allow only admins to execute a command

一曲冷凌霜 提交于 2019-11-28 12:01:45
问题 i am writing following command @bot.command(pass_context=True) async def admins_only_command(ctx, *, args): '''do stuff how can i restrict this command to admins only? I tried looking at ctx.author.roles.role and it says @everyone . How can i check if the given user is an admin or not? 回答1: There are two ways: by a whitelist of roles using has_any_role @bot.command(pass_context=True) @commands.has_any_role("Big Cheese", "Medium Cheese") async def admins_only_command(ctx, *, args): '''do stuff

Send a message with Discord.js

那年仲夏 提交于 2019-11-28 12:01:42
So. I am trying to make a discord bot, but i can't quite understand Discord.js. My code looks like this: client.on("message", function(message) { if(message.content === "ping") { client.message.send(author, "pong"); } }); And the problem is that I can't quite understand how to send a message. Can anybody help me ? You have an error in your .send() line. The current code that you have is used in an earlier version of the discord.js library, and the send function has been changed. To send a message, use this line: message.channel.send('My Message') If you get an error saying that message is not

How to use local file as thumbnail in DiscordJS embedded message?

守給你的承諾、 提交于 2019-11-28 09:10:56
问题 Is it possible to use a local file as a thumbnail for an embedded message with DiscordJs? "thumbnail": { "url": "../img/025.png" }, This doesn't seem to work. (node:34721) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): DiscordAPIError: Invalid Form Body embed.thumbnail.url: Not a well formed URL. Normal URL's do work however. 回答1: I've already found an answer. Linking to the proper url of the file wasn't an option for me, because some images were generated.