Giter Club home page Giter Club logo

Comments (4)

callihann avatar callihann commented on May 27, 2024

If it is possible could you provide an example with an implementation?


hey it's arandomnewaccount replying by editing (cause my acc is hidden):
Multiple tokens are supported. You'll just have to initialize multiple discum.Client objects:

bot0 = discum.Client(token='user0')
bot1 = discum.Client(token='user1')
bot2 = discum.Client(token='user2')

I suppose if you had a large list of tokens and you wanted to automatically initialize clients for all of them, you could like this:

clients = []
for token in tokenlist:
    clients.append(discum.Client(token=token))

and then do clients[some_index_idk].sendMessage(...) or whatever function you're using.

...
Another edit:
I'll be closing this issue in a few hours unless you have more questions/issues related to this.

from discord-s.c.u.m.

callihann avatar callihann commented on May 27, 2024

Sorry to reopen this, I don't really understand how to implement this. I am trying to import tokens from a json file and want to automatically initialize it. RIght now I have this:
`
with open ('tokens.json') as f:
data= json.load(f)

clients = []
for token in data:
clients.append(discum.Client(token=Tokens))
async def first():
clients.getGuilds()
print("initializing...")
`

When I run this I get the error Token is not defined. Sorry to bother you!

from discord-s.c.u.m.

callihann avatar callihann commented on May 27, 2024

The formatting is a little messed up sorry.


arandomnewaccount:
no problem. Here's a "fixed" version:

with open('tokens.json') as f:
    data= json.load(f)

print("initializing...")
clients = []
for token in data:
    clients.append(discum.Client(token=token))

Now, I'm not entirely sure about your "clients.getGuilds()" line since clients is a list (see code above). If you'd like to get the guilds a client is in, you'll have to connect to the websocket and then do clients[some_index].gateway.session.guildIDs.

Lemme know if that helps.

from discord-s.c.u.m.

callihann avatar callihann commented on May 27, 2024

Thank you so much! That resolved it. Thank you for humoring me. Have a good day!

from discord-s.c.u.m.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.