AttributeError: 'Guild' object has no attribute 'icon_url'

guild = bot.get_guild(guild_id) thumbnail = guild.icon_url if guild.icon_url else None Error: thumbnail = guild.icon_url if guild.icon_url else None ^^^^^^^^^^^^^^ AttributeError: ‘Guild’ object has no attribute ‘icon_url’ Im trying to get guild icon url but i cant >Solution : thumbnail = guild.icon.url if guild.icon else None

Discord Bot reply to my messege with text and provided data. Python

I want write command "!addpoints "numOfPoints"" and bot should reply to this message this: You added "numOfPoints" points. I tried make it, like it is on photo:code but I got this errors: errors errors1 >Solution : First off, post your code and errors as text, not images. You’re trying to use ctx.reply() as print. You… Read More Discord Bot reply to my messege with text and provided data. Python

Getting error while making a dropdown menu for discord bot

Below is the code I am writing The main work is to create a dropdown menu which proceed’s with an option to show all the available commands in the bot. #MODULES——————————————————————————————————————————————–| import os import time import json import discord from discord.ui import Select, View from discord.ext import commands #GETTING DATA FROM CONFIG FILE———————————————————————————————————————-| def load_data(file_path):… Read More Getting error while making a dropdown menu for discord bot

SyntaxError: invalid syntax when using Await inside an asynchronous function

Bugged Code: async def add(ctx, *, newalbum): current_month = str(datetime.now().month) await ctx.send(f'{newalbum} has been added to the queue’) await with open("albums.json", "r") as albumfile: data = json.load(albumfile) await with open("albums.json", "w") as albumfile: data[current_month] = str(newalbum) Error: await with open("albums.json", "r") as albumfile: ^^^^ SyntaxError: invalid syntax I will note that I am using python… Read More SyntaxError: invalid syntax when using Await inside an asynchronous function

discord.py – 'TypeError: on_member_ban() takes 1 positional argument but 2 were given' error when on_member_ban event runs

I’m making a logging system. (thank god finally something else for once) Everything has been going smoothly, until now. I have a issue with my on_member_ban event, and it gives me an error saying TypeError: on_member_ban() takes 1 positional argument but 2 were given. I’ve tried everything, no answer. Absolutely nothing. The thing is, I… Read More discord.py – 'TypeError: on_member_ban() takes 1 positional argument but 2 were given' error when on_member_ban event runs

Is there a way to disable my discord bot's direct messages in discord.py?

I have 2 bots and another one of them includes alot of slash commands, I don’t want anyone to have access to use these commands in the bot’s direct messages. I have tried to find a way to disable my bot’s direct messages but couldn’t find any. >Solution : You can use the guild_only decorator/check… Read More Is there a way to disable my discord bot's direct messages in discord.py?

discord isnt recognising the roleid when it exists

import discord from discord import app_commands import json intents = discord.Intents().all() client = discord.Client(intents=intents) tree = app_commands.CommandTree(client) @tree.command(name="subscribe") async def the_command(interaction, itemid: str): discid = int(interaction.user.id) print(discid) with open("data.json", "r") as file: data = json.load(file) if itemid in data: role_id = data[itemid]["roleid"] print(role_id) guild = interaction.guild print(guild) member = await guild.fetch_member(discid) print(member) if member is… Read More discord isnt recognising the roleid when it exists