Terisback / discord.v

Discord Bot Framework written in V
MIT License
120 stars 12 forks source link

builder error: bad module definition "eventbus" #22

Closed zztkm closed 3 years ago

zztkm commented 3 years ago

The problem occurred when I was trying the README Example.

v run main.v

C:\Users\myname\.vmodules\terisback\discordv\client.v:6:1: builder error: bad module definition: 
C:\Users\myname\.vmodules\terisback\discordv\client.v imports module "eventbus" but 
C:\Users\myname\.vmodules\terisback\discordv\eventbus\eventbus.v is defined as module `terisback.discordv.eventbus`                                                                       
4 | import term 
5 | import time                                                                                                       
6 | import eventbus                                                                                                      
   | ~~~~~~~~~~~~~~~                                                                                                     
7 | import gateway                                                                                                      
8 | import rest 

I figured it was probably a conflict with vlib.

So, I made the following changes to discord.v

clienv.v

// fix import path
import discordv.eventbus

But I got the following error

v run main.v
C:\Users\myname\.vmodules\terisback\discordv\eventbus\eventbus.v:8:8: error: cannot register struct `terisback.discordv.eventbus.Registry`, another type with this name exists
    6 | // Registry of event handlers
    7 | [heap]
    8 | struct Registry {
      |        ~~~~~~~~
    9 | mut:
   10 |     events []EventHandler

I'm currently investigating this, does anyone have a good solution?

Thank you.

Terisback commented 3 years ago

Clone lib somewhere else and make symlink to it in vmodules

Terisback commented 3 years ago

Open one more issue in vlang repo, please

zztkm commented 3 years ago

Clone lib somewhere else and make symlink to it in vmodules

I was able to solve the problem. Thank you!

Open one more issue in vlang repo, please

Should I write about the fact that it doesn't work well without symlink?

Terisback commented 3 years ago

Yep