title: Getting the guild id in an on_user_update event in discord.py
body: <p>So I'm trying to make an on_user_update event and to send the message I need to fetch the channel_id that is set as the log channel for the guild, which I sort by guild_id, but on_user_update has no guild attribute. So how would I achieve my goal?</p>
  <p>Here's the code:</p>
  <pre class="lang-py prettyprint-override"><code>@bot.event
  async def on_user_update(before, after):
      async with aiosqlite.connect('database.sqlite') as db: 
          async with db.execute(&quot;SELECT channel_id FROM logging WHERE guild_id = ?&quot;, (&quot;answer goes here&quot;)) as cursor:
              result = await cursor.fetchone()
          if result is not None:
              channel = bot.get_channel(id=int(result[0]))
      
      if before.avatar != after.avatar: 
          av = discord.Embed()
          av = discord.Embed(title=&quot;**User Avatar Updated:**&quot;, color=7419530, description=f&quot;After:&quot;)
          av.set_image(url = after.avatar_url)
          await channel.send(embed=av)
  </code></pre>