Skip to content

Commit 3073dd2

Browse files
committed
Update for discord.py 2.0.*
1 parent b3f1e83 commit 3073dd2

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ apt-get -y install python3 python3-pip
1010
``
1111

1212
``
13-
python3 -m pip install discord.py==1.3.4
13+
python3 -m pip install discord.py==2.0.1
1414
``
1515

1616
## HOW TO USE

networkbot.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# DEPENDENCIES
66
# sudo apt-get install python3
77
# sudo apt-get -y install python3-pip
8-
# python3 -m pip install discord.py==1.3.4
8+
# python3 -m pip install discord.py==2.0.1
99
#
1010
# HOW TO USE
1111
# Go to https://discordapp.com/developers/applications/
@@ -21,6 +21,7 @@
2121
import random
2222
import asyncio
2323
import aiohttp
24+
import discord
2425
import json
2526
from discord.ext import commands
2627
from discord.ext.commands import Bot
@@ -47,7 +48,8 @@
4748
PORT = "YOUR_RPC_PORT_GOES_HERE"
4849

4950
# start a bot
50-
client = Bot(command_prefix=BOT_PREFIX, description=description)
51+
intents = discord.Intents.all()
52+
client = Bot(command_prefix=BOT_PREFIX, description=description, intents=intents)
5153

5254
# commmand: &height
5355
# network top block height
@@ -146,6 +148,9 @@ async def list_servers():
146148
print('Active servers: ' + str(server.name))
147149
await asyncio.sleep(600)
148150

151+
async def main():
152+
async with client:
153+
await client.loop.create_task(list_servers())
149154

150-
client.loop.create_task(list_servers())
151155
client.run(TOKEN)
156+
asyncio.run(main())

0 commit comments

Comments
 (0)